maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Holopainen <>
Subject Re: maven release plugin and subversion externals
Date Wed, 06 Jun 2012 11:50:45 GMT
Start with reading the Maven release plugin description, specially prepare
and perform action's documentation. 

This problem with svn:externals is that IF you are using svn:externals that
link to the project itself the release branch will point to the trunk.

release:prepare phase will 
1. crawls the project's pom.xml and change the <version> number to the given
release version  
2. commits the changed code to SVN repo using each module's  <scm>
<developerConnection> - value
3. makes an svn copy of the revision it jsut committed to svn to the
<tagbase> (defaulting to "../tags" relative to scm-developerConnection value 
4. it then again crawls the project's pom.xml and change the <version>
number to the next SNAPSHOT version

NOW, here is the problem ! 
Let's assume that you have the externals properties defined to the projects
root folder. Now when the release:prepare makes a copy of that folder in SVN
it is a copy and that copy contains identical properties. So both the folder
in trunk and the copy of the folder in release - branch contain IDENTICAL
dynamic links to the trunk of the modules sub folders which now have the
next -SNAPSHOT version in them. So when you run the release:perform it
"releases" the the next SNAPSHOT, not the release. 

This is easy to fix, but only as long as you are using svn:externals _ONLY_
at the root level of the project !  
You must do little magic between running release:prepare and relese:perform.
So you ABSOLUTELY MUST NOT run in same mvn command (mvn relese:prepare
release:perform) ! Instead you must:
1. First run the release prepare. 
2. The look at the Maven ouput (or run: mvn log . ) to find revision number
of the relase branch version (svn copy). 
3. Now armed with the revision number of the release you must checkout the
new release branch to some temp folder (The HEAD not the revision!). Go the
the folder where you just checked out the release branch and edit that
folder's svn properties, "svn propedit svn:externals ." and add the revision
we talked about to each modules link definition "-r123". Then remember to
commit it back to svn !  
4. That's it ! Now Go back to the folder you ran the release:prepare at. And
delete this temp folder to where you checked out the release to. Now run
"mvn release:perform" which checks out the release branch to a temp folder
where it build, tests and deploys artifacts to the maven repo. Now that the
links in SVN release branch point to correct revision of the source code
everything works ok. 

You do need to do this for every time you make a relase. You can script all

P.S. When I talk about "branch" I mean svn release "tag", I just feel in
this context word "branch" better describes what we are doing (and in svn
there is no tag or branch, just copy).

View this message in context:
Sent from the Maven - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message