I have a pom file in which version numbers of some dependencies rely on the project version property specified in the settings of the pom file. Can I overwrite this via the command-line? If so, how?
Here's the long story:
We are currently transitioning our projects to maven, but we're not all the way there yet. There are multiple modules that are still not built with maven and are therefore dependencies in our project (they are built into jars through ant). Upon release, we want all of these jars to be built and contain the same version number as the parent project. For a release, two steps are performed (until we can get everything using maven)
- The jars are built in ant with the correct release version (12.12.4.0).
- The maven release plugin is used to deploy the project to our artifact repository.
In the second step command-line arguments are used to specify the release:
mvn release:prepare -DreleaseVersion=12.12.4.0 -DdevelopmentVersion=12.12.4.1-SNAPSHOT -Dtag=iv-12.12.4.0
I would like the pom file to be updated with the version specified. However, when this command is run, the version within the pom file (12.12.4.0-SNAPSHOT) is still being used. This fails the "checking dependencies and plugins for snapshots" step and I am required to resolve my jars that still have the 12.12.4.0-SNAPSHOT version used from the maven version property.
This led me to the original question of how I can override this so that the version resolves to that specified on the command line. Additional questions that could get me past this is: How to allow the maven release plugin to update the pom file before this check? How to skip the snapshot check (not desirable)
I could create a property within the pom file that I can overwrite, but then I'd have to maintain the version number in two places within the pom file.
Thoughts?