user4903
user4903

Reputation:

Maven release plugin adding trunk folder under release tag for release:prepare goal

My SCM connection information:

<scm>
    <connection>scm:svn:https://repo/project/trunk</connection>
    <developerConnection>scm:svn:https://repo/project/trunk</developerConnection>
</scm>

My release plugin configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <tag>RC</tag>
        <autoVersionSubmodules>true</autoVersionSubmodules>
    </configuration>
</plugin>

Now when I run mvn release:prepare, instead of committing my tagged release under tags/RC, it does tags/RC/trunk. How do I stop it from adding trunk under RC?

Upvotes: 3

Views: 1783

Answers (1)

Mihai Danila
Mihai Danila

Reputation: 2348

Brian, you may be the victim of Maven's incomplete release:rollback feature. See my question on StackOverflow and the answer to it. If your tag already exists, Subversion (not Maven) will think you want to copy trunk inside the existing tag. Delete the tag and it will work - once. Try again and you'll get RC/trunk. Try yet again and you'll get an error from Subversion.

The solution is to svn delete the tag before you try to copy to it - we do this successfully from Maven during release:perform, by binding a couple of plugins to the deploy phase.

Basically:

  • Let release:prepare do its thing, create a tag with a unique name.
  • Bind org.codehaus.mojo:exec-maven-plugin:exec to the deploy phase to make it run during release:perform. Configure it to call svn delete <path to RC tag>.
  • Bind maven-scm-plugin:branch to deploy in order to create the tag fresh using Maven's SCM plugin.

This works for us and it has the added benefit that it gives us the unique tags too for reference. Worst case, you can ignore these tags.

Upvotes: 5

Related Questions