Question

I am trying to create a branch from a tag with maven but the developerConnection property is not updated. How do I do this through maven or editing the pom.xml file manually?

We use subversion for scm and maven for build/release. I want to create a branch from the latest tag (release). We will use the branch for maintenance of the code, including bug fixes, and continue developing on the trunk. (I know that discussion of developing on trunk versus on branch is involved, and I don't want to open that up.)

When I use release:branch to create the branch, the developerConnection property refers to the tag that I checked out of to create my working copy. I want it to point to the branch.

  1. I checked out the latest tag. (foo-80.0.8)
  2. From the command line in the working copy directory of that tag, I ran:

    mvn release:branch -DbranchName=foo-80.0.8.1.x -DupdateWorkingCopyVersions=false
    

    (The .1.x refers to the 1 st branch with x as a placeholder indicator for branch version.)

In the resulting pom.xml in the branch on the repository, the developerConnection property was set to ...Foo/tags/foo-80.0.8 (I omitted the beginning of the URL to prevent the automatic hyperlink.) I want it to be ...Foo/branches/foo-80.0.8.1.x

I tried again, but this time, I edited the pom.xml file, and changed developerConnection to ...Foo/branches/foo-80.0.8.1.x. After running mvn release:branch ..., developerConnection in the pom.xml file still pointed to the tag.

UPDATE:

I took @twomey1's suggestion. (Thanks!) Now developerConnection points to ...\tags\foo-80.0.8.1.x which is not the original tag (good), but that tag doesn't exist (bad). I checked out a fresh copy of the new branch, modified pom.xml to point to the branch, and committed the change. When I tried mvn release:prepare I got this error message:

[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-release-plugin:2.0-beta-7:prepare (default-cli) on
project foo: You don't have a SNAPSHOT project in the reactor projects list.

UPDATE:

@twomey1's comment about SNAPSHOT helped. Using -DupdateVersionsToSnapshot on the command line, I got release:prepare to go forward but there still seems to be confusion with tags and branches. Again, my workflow:

  1. Run svn checkout https:.../tags/foo-80.0.8.
  2. Run mvn -DupdateVersionsToSnapshot=true -DupdateBranchVersions=true -DupdateWorkingCopyVersions=false -DbranchName=foo-80.0.8.1 release:branch from the working copy of the tag that was just checked out.
  3. Run svn checkout https:.../branches/foo-80.0.8.1 from the parent directory of the working copy.
  4. Run mvn release:prepare from the working copy of the branch that was just checked out.

Then I get a svn error passed from maven that tag foo-80.0.8.1 already exists. I want to create a release from the branch which should not conflict. The developerConnection property still points to ...\tags\foo-80.0.8.1 which doesn't exist.

UPDATE:

I repeated with this difference, I added .1 to the end of the release version, the SCM release tag, and the portion of the development version before SNAPSHOT. This seems to work. I did this during mvn release:prepare.

Was it helpful?

Solution

From the official release plugin documentation

By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision. If you want to update versions in the new branch and not in the working copy, run:

mvn release:branch -DbranchName=my-branch -DupdateBranchVersions=true -DupdateWorkingCopyVersions=false

Note: This can be useful if you want to create a branch from a tag

http://maven.apache.org/maven-release/maven-release-plugin/examples/branch.html

I think you are just missing -updateBranchVersions=true from your command

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top