I started learning maven, and now I'm trying to make some realworld projects with starting simple. Maybe it looks simple, first of all, here, but I'm really confused about what I should do if I want to pack both parent and child projects at the same time.
(PS: I am using intellij idea btw)
here is my configuration
Project A
- Suppose it depends on guava and gson
Project B
- it will depend on project A
Project C
- it will depend on project B
when I set the packing attribute of Project A to the jar, it gives an error, basically saying that "you have to set the packing element as pom if it is in the parent pump". But I know that if I install the packaging element as pom, it will not create a package.
, , , ! , jar ?
- ,
MODULE POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.deneme.module</groupId>
<artifactId>ModuleGroup</artifactId>
<packaging>pom</packaging>
<version>1.0.1</version>
<modules>
<module>A</module>
<module>B</module>
</modules>
</project>
A
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mg.A</groupId>
<artifactId>A</artifactId>
<version>1.0.2</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.3</version>
</dependency>
</dependencies>
</project>
B
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<parent>
<artifactId>A</artifactId>
<groupId>com.mg.A</groupId>
<version>1.0.2</version>
<relativePath>../A/pom.xml</relativePath>
</parent>
<groupId>com.mg.B</groupId>
<artifactId>B</artifactId>
<version>1.0.1</version>
</project>