Reputation: 691
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?
Upvotes: 18
Views: 16592
Reputation: 1
I eventually ran mvn -X to discover one of my child poms was saved in UTF-8 BOM encoding:
[DEBUG] Could not parse child-project\pom.xml java.io.IOException: only whitespace content allowed before start tag and not \uef (position: START_DOCUMENT seen \uef... @1:1) at org.codehaus.mojo.versions.api.PomHelper.getRawModel (PomHelper.java:116)
The Exception was 'hidden' in DEBUG logging.
I re-saved it using UTF-8 encoding, and it worked.
(Encountered with Maven 3.5.4 / Versions-Maven-Plugin 2.7)
Upvotes: 0
Reputation: 31
If anyone searching for an answer, below command worked like a charm for me
mvn release:update-versions -DdevelopmentVersion=4.4.0-SNAPSHOT
Upvotes: 1
Reputation: 177
Alternatively you can also use the processAllModules parameter.
$ mvn versions:set -DnewVersion=2.0.0 -DprocessAllModules
Upvotes: 8
Reputation: 66711
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
Upvotes: 2
Reputation: 190
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=*
Upvotes: 19
Reputation: 1133
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.
Upvotes: 2
Reputation: 727
Maybe is because you don't declare the plugin in parent pom in Plugin Management. If you want to propagate the plugin to the childs you have to declare in Plugin Management Section.
See: http://maven.apache.org/pom.html#Plugin_Management
Upvotes: 0