In the following example Maven 3 will output a warning Maven version contains expression but should be a constant. This is because we use the expression ${project.parent.version} in the version tag of this Maven module.
<parent> <groupId>com.mycompany</groupId> <artifactId>myapp</artifactId> <version>5.0.0-SNAPSHOT</version> </parent> <groupId>com.mycompany</groupId> <artifactId>myAppEar</artifactId> <version>${project.parent.version}</version>
So why is Maven complaining about Maven version contains an expression ?
It doesn’t make much sense to make this version non-static, because the maven-release-plugin will automatically update it when doing a release. (eg. when it will change). Make the pom.xml the master of the version tag, not some other file; this will make your life easier when you start eg. using the maven-release-plugin (no need for special configuration)
If you want to use the parent pom version in sub-modules, you can remove it, because the sub-module will automatically inherit the version of the parent if it is ommitted.
what if i want to make the parent.version to be dynamic.
parent.pom:
my.group
parent
${current.version}
1.0-SNAPSHOT
child.pom:
parent
my.group
${current.version}
so the current.version is only define once in parent.pom. I think this is quite reasonable to use, but why is maven still complaining?