I am curious to know what is the real problem with binding the module version to the parent version, if any? Or is this a case of general warning when any expression is used for a version element, regardless of whether it is used by project.parent.version.
Well, that would be easy to verify. Since I was curious, I just did it for you using the following pump:
<project> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>parent</artifactId> <groupId>com.mycompany</groupId> <version>1.0-SNAPSHOT</version> </parent> <groupId>com.mycompany</groupId> <artifactId>module</artifactId> <version>${myversion}</version> <name>module</name> <url>http://maven.apache.org</url> <properties> <myversion>1.0-SNAPSHOT</myversion> </properties> ... </project>
And the mawan really complains
[WARNING] 'version' contains an expression but should be a constant. @ com.mycompany:module:${myversion}, /home/pascal/Projects/maven-maven3-testcase/module/pom.xml
To be honest, I think maven is here, it doesn't make much sense to use the property for the <version> element (at least for project.version), and it's nice that maven complains about it.
And if you want to use the version of the parent pom in the submodules, just remove the <version> from the child poms , they will inherit the version from the parent. What you are doing now is not necessary.
Pascal Thivent Dec 30 '09 at 19:40 2009-12-30 19:40
source share