1
votes

I am not sure if I am doing something wrong here, or if there is a bug in maven-release-plugin. But when I try to release a version 1.2.1, maven creates a tag with the right version, but the version number set in the tag's pom.xml is set at 1.2 (not 1.2.1 as it should).

This is what I do when I tried to fix a bug in 1.2:

  1. svn cp URL/tags/myapp-1.2 URL/branches/myapp-1.2
  2. edit project.version in URL/branches/myapp-1.2/pom.xml to be 1.2.1-SNAPSHOT (was 1.2)
  3. fix the bug in the source
  4. commit changes
  5. mvn release:prepare
  6. #when asked, use the defaults: release version 1.2.1, next dev version 1.2.2-SNAPSHOT
  7. [INFO] BUILD SUCCESSFUL

OK so far, but if I check out the code in the new tag the version is wrong! URL/tags/myapp-1.2.1/pom.xml has version 1.2, not 1.2.1 as the tag name should suggest. If I just run mvn release:perform now, the new uploaded jar will have its name set to myapp-1.2.jar, overwriting the original in the repository.

I have upped the maven-release-plugin version from 2.0 to 2.1, but with no greater success. I know the thing that causes this error is the part of the process where the plugin does this:

svn --non-interactive copy --file /tmp/maven-scm-2371633.commit --revision 19866 URL/tags/myapp-1.2 URL/tags/myapp-1.2.1

This copies the source from tags/myapp-1.2 to tags/myapp-1.2.1, but this does not contain any changes. Do you agree that it should have copied from branches/myapp-1.2, not the tag?

Is this working for anyone else, and do you see if I am doing anything wrong?

1
Have you changed the SCM Area in those pom which you are using from the branch? Cause the pom in the tag has rewritten scm information in the SCM area with full qualified information about tags etc.and not what you expect. Furthermore i would suggest to use the three digit version number like 1.2.0 and in case of bug fix you can changes this to 1.2.1 etc.khmarbaise
You should take a deep look into the maven-release plugin, cause it supports the branching you are doing manually (maven.apache.org/plugins/maven-release-plugin/examples/…).khmarbaise
Thanks, khmarbaise. I wonder if I might have left out some crucial info here. myapp is actually a submodule of a root-project. as in /trunk/myapp/. does this matter?oligofren
If this means you have a multimodule build than this matters cause than the configuration scm area should only be done in the root of your project.khmarbaise

1 Answers

0
votes

You need to verify if the repository link in your pom is pointing to a branch instead of the trunk.

If that is the case, then you'll get the error. Point it to the trunk, instead.