After finally getting tired of maven release plugin I deceided to move on to something more simpler.
I have a project, with a couple of modules.
When I do
mvn versions:set -DnewVersion=1.0.2-SNAPSHOT
it just changes the parent and skips all child modules?
what am I doing wrong? do I need to set another parameter as well?
I had the same problem of submodules referencing external parents.
If the child's parent version matches the parent's local version, then it updates the versions of the parent and child (it might say SKIPPED but still work, bizarrely). If they don't match then it seems to only update the parent's version and update the children to point to the new parent, it doesn't change the children's versions at all.
Finally i found that wildcards could resolve this problem (requires a new'ish version of the versions plugin):
mvn org.codehaus.mojo:versions-maven-plugin:2.2:set -DnewVersion=1.5.0a -DartifactId=* -DgroupId=*
Alternatively you can also use the processAllModules parameter.
$ mvn versions:set -DnewVersion=2.0.0 -DprocessAllModules
If you're like me with a project whose child modules don't match the parent's version, another option is to adjust them to match first:
$ mvn versions:update-child-modules
then versions:set (and versions:replace-snapshot etc.) will now work as expected, without needing a newer version of the plugin :)
$ mvn versions:set -DnewVersion=1.0.2-SNAPSHOT
I'm assuming that your project structure is like this:
parent/pom.xml
child/pom.xml
Then you have to run mvn versions:set -DnewVersion=1.0.2-SNAPSHOT
from parent/
directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With