I have a Maven project "core". In the project's pom.xml, the version is 0.1. I use a parameterized build in Jenkins and set a text parameter myNewVersion=3.1. I also set the following maven goals:
versions:set -DnewVersion=${myNewVersion} versions:commit deploy
When the being built, maven updates the version in the pom.xml correctly to "3.1". However the maven deploy task deploys my project as "core-0.1", the version being still 0.1. The pom file included in the corresponding 0.1 dir in my Nexus states the version number "3.1".
What can I do to force the maven deploy task to use the correct version set by the maven versions plugin?
Thank you very much for your help.
EDIT 1: To clarify my needs: The version of the project in the POM should not state an actual build version. I use it to determine the compatability of my "core" project to underlying systems and APIs. In more detail: The project "core" gets a "interfaceVersion=3.1" or "interfaceVersion=4.0" parameter from jenkins. This determines which version my core project uses for its dependency to another "libraries" bundle.
Now, I have two Jenkins build jobs, one for 3.1 and one for 4.0 library-project dependency of the core project. Each checks out the same project code from SVN, but passes a different version parameter to the "core" project being build. I want to use this version number as my project's version number in the pom.xml AND as version number of my jar being deployed to the nexus (i.e. core-3.1.jar or core-4.0.jar).
Edit 2: I've come a little further. I just use the version parameter that I set in jenkins as a parameter in my parameterized build section as the project's version number in the pom file. Maven warns about doing this, but it works. However, all my projects depending on "core" now need to specify "${myNewVersion}" as the dependency version, too.
So I try to use the versio