3

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?

vegemite4me
  • 6,621
  • 5
  • 53
  • 79
  • Thy did you configure the tag ? If you are using default layout in SVN you don't need to configure that. – khmarbaise Jul 03 '12 at 16:44
  • If you don't configure the tag, then it is up to the developer to specify the tag when preparing the release. We don't want that. We simply want the current release tagged, which means it is production ready. –  Jul 03 '12 at 17:16
  • That's simply wrong. The tag is created by default by the artifactId plus the version. The release plugin will ask you but you can accept the default but if you give -B on command line it will do things automatically without any user interaction but using the defaults (increment of version etc.). – khmarbaise Jul 04 '12 at 04:28
  • That still leaves room for error on the developer's part. If the POM has the tag name in it, then it does not ask you what you want to tag it. Besides the fact that still doesn't answer my question, and is actually the opposite of what I want. I don't want it to default to artifactId plus the version. I want the same tag every time. –  Jul 04 '12 at 23:53
  • Making the same tag every time does not make sense, cause if you release via Maven this will create a new version and related to that is makes no sense. The pom only has a tag name in it if you have a released artifact usually you have a SNAPSHOT version in it which means the trunk in the scm area will be used. – khmarbaise Jul 05 '12 at 06:49

1 Answers1

5

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.

Community
  • 1
  • 1
Mihai Danila
  • 2,229
  • 1
  • 23
  • 28