java - Best approach for maven multi module project -
i have problem multi module maven project when need specify sub-module dependencies parent module
here configuration pom.xml
parent pom:
<groupid>com.parent</groupid> <artifactid>parent</artifactid> <packaging>pom</packaging> <version>1.0-snapshot</version> <modules> <module>childa</module> <module>childb</module> </modules>
childa pom
<parent> <groupid>com.parent</groupid> <artifactid>parent</artifactid> <version>1.0-snapshot</version> </parent> <modelversion>4.0.0</modelversion> <artifactid>childa</artifactid> <dependencies> <dependency> <groupid>com.parent</groupid> <artifactid>parent</artifactid> <version>1.0-snapshot</version> </dependency> </dependencies>
childb pom
<parent> <groupid>com.parent</groupid> <artifactid>parent</artifactid> <version>1.0-snapshot</version> </parent> <modelversion>4.0.0</modelversion> <artifactid>childb</artifactid>
i able build childb when running mvn clean install
inside childb.
i getting error when build parent , childa error message
error] failed execute goal on project parent: not resolve dependencies project com.parent:childa:jar:1.0-snapshot: not find artifact com.parent:parent:jar:1.0-snapshot -> [help 1]
i need added dependency inside childa pom.xml parent package due classes available on parent package
how should resolve issue?
the childa
pom makes no sense.
it has same artifact both dependency parent , build dependency :
<parent> <groupid>com.parent</groupid> <artifactid>parent</artifactid> <version>1.0-snapshot</version> </parent>
and :
<dependencies> <dependency> <groupid>com.parent</groupid> <artifactid>parent</artifactid> <version>1.0-snapshot</version> </dependency> </dependencies>
first : dependency resolution never success chicken , egg problem.
parent module produces pom available reactor build terminated terminated modules, among childa
, terminate build.
second : multi module maven project , parent module designed packaged pom
, not jar
.
interest declare dependency of childa
?
remove , keep parent of childa
.
i need added dependency inside childa pom.xml parent package due classes available on parent package
you don't need specify dependency achieve it.
child projects inherit many things parent project, among dependencies.
Comments
Post a Comment