I have a multi-module (aggregator) Maven project that also inherits properties from the parent pom. So in my parent pom.xml I have this:
<groupId>com.something.project</groupId>
<artifactId>MyProject</artifactId>
<packaging>pom</packaging>
<version>1.0.123</version>
<modules>
<module>ModuleA</module>
<module>ModuleB</module>
<module>ModuleC</module>
</modules>
I would like to have all the child modules inherit the parent version number 1.0.123
, but the child pom.xml
requires me to go ahead and hardcode the version number of the parent anyway (ModuleA pom.xml example):
<artifactId>ModuleA</artifactId>
<name>Some Amazing Thing</name>
<parent>
<relativePath>../</relativePath>
<artifactId>MyProject</artifactId>
<version>1.0.123</version>
<groupId>com.something.project</groupId>
</parent>
How can I just put the version number in the parent pom, and have the modules inherit it without having to update it in multiple places? So far I've tried ${project.version} and ${project.parent.version} and Maven seems very unhappy with that. Nor can I remove the version reference entirely.
Does anyone have a good answer for this?