Maven dependecy mangement artiafctId with ${project.artiafctId} -
in parent child :
<project> ... <dependencies> <dependency> <groupid>${parent.groupid}</groupid> <artifactid>${parent.artifactid}-war</artifactid> <type>war</type> </dependency> </dependencies> ... </project>
in parent :
<project> ... <dependencymanagement> <dependencies> <dependency> <groupid>${project.groupid}</groupid> <artifactid>myproject-war</artifactid> <version>${project.version}</version> <type>war</type> </dependency> </dependencies> </dependencymanagement> ... </project>
just wondering why using (in parent)
<artifactid>myproject-war</artifactid>
is working , using
<artifactid>${project.artifactid}-war</artifactid>
is not working
[0] 'dependencies.dependency.version' missing be.lab:myproject-war:war
you should think setup. apart updating last maven version (3.1.1)..
root -- pom.xml +--- m1 (pom.xml) +--- m2 (pom.xml) +--- m3 (pom.xml)
you root (parent) looks this:
<project ....> <modelversion>4.0.0</modelversion> <groupid>com.soebes.maven.training</groupid> <artifactid>parent</artifactid> <packaging>pom</packaging> <version>1.0.0-snapshot</version> <modules> <module>m1</module> <module>m2</module> <module>m3-war</module> </modules> ... </project>
a typical childs looks ths:
i suggest define dependencies between child in childs this:
<project ..> <modelversion>4.0.0</modelversion> <parent> <groupid>com.soebes.maven.training</groupid> <artifactid>m1</artifactid> <version>1.0.0-snapshot</version> </parent> <artifactid>m1</artifactid> </project>
a child dependency other child looks this:
<project ..> <modelversion>4.0.0</modelversion> <parent> <groupid>com.soebes.maven.training</groupid> <artifactid>m1</artifactid> <version>1.0.0-snapshot</version> </parent> <artifactid>m2</artifactid> <dependencies> <dependency> <groupid>${project.group}</groupid> <artifactid>m1</artifactid> <version>${project.version}</version> </dependency> </dependencies> </project>
furthermore usage of things ${parent.*}
isn't practice.
and lets have @ war module:
<project ..> <modelversion>4.0.0</modelversion> <parent> <groupid>com.soebes.maven.training</groupid> <artifactid>m1</artifactid> <version>1.0.0-snapshot</version> </parent> <artifactid>m3-war</artifactid> <dependencies> <dependency> <groupid>${project.group}</groupid> <artifactid>m2</artifactid> <version>${project.version}</version> </dependency> </dependencies> </project>
i recommend not use such constructs <artifactid>${parent.artifactid}-war</artifactid>
. better use in such situations <artifactid>module-war</artifactid>
cause wouldn't save much.
Comments
Post a Comment