eFox's answer worked for a single project, but not when I was referencing a module from another one (the pom.xml were still stored in my .m2
with the property instead of the version).
However, it works if you combine it with the flatten-maven-plugin
, since it generates the poms with the correct version, not the property.
The only option I changed in the plug-in definition is the outputDirectory
, it's empty by default, but I prefer to have it in target
, which is set in my .gitignore
configuration:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.0.1</version>
<configuration>
<updatePomFile>true</updatePomFile>
<outputDirectory>target</outputDirectory>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
</executions>
</plugin>
The plug-in configuration goes in the parent pom.xml