(please see bottom of email for environment/version information)

I am trying to use the "release:branch" goal to create a branch, setting the 
version in the POMs in both the new branch and the working copies.  No matter 
what properties I define on the command line, the release plugin is overriding 
the branch version information to what it thinks (incorrectly in my opinion) it 
should be.  It looks like the release version is being set either by 
calculation from current project version, or supplied development version.

I.e.  when calling Maven with the following (snippet)

-DreleaseVersion=1.0.0
-DdevelopmentVersion=1.0.1-SNAPSHOT
-DupdateVersionsToSnapshot=false
-DdryRun=true

The version in all the pom.xml.next files is as expected (1.0.1-SNAPSHOT), but 
the version in all the pom.xml.branch files is not as expected (1.0.1-SNAPSHOT 
when I would expect 1.0.0).

Am I missing something that would explain why the above is correct?  Or am I 
missing something obvious in how to configure the plugin to work as expected?

(I've included a very simple repro in the grey breakout box below )

Thanks
Mark



Very simple setup to demonstrate:

Project structure

|   pom.xml
|
+---child-one
|       pom.xml
|
\---child-two
        pom.xml

Root pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>

  <modelVersion>4.0.0</modelVersion>

  <groupId>org.gibbo</groupId>
  <artifactId>gibbo-pom</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>Gibbo Parent POM</name>


  <modules>
    <module>child-one</module>
    <module>child-two</module>
  </modules>


  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>


  <scm>
    <connection>
      scm:git:ssh://g...@bitbucket.org/mwgibson/gibbo.git
    </connection>
    <developerConnection>
      scm:git:ssh://g...@bitbucket.org/mwgibson/gibbo.git
    </developerConnection>
    <url>
      https://bitbucket.org/mwgibson/gibbo
    </url>
  </scm>


  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.9.1</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5</version>
      </plugin>

    </plugins>
  </build>

</project>

child-one pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.gibbo</groupId>
    <artifactId>gibbo-pom</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>child-one</artifactId>
  <packaging>pom</packaging>
  <name>Gibbo Child One POM</name>

</project>

child-two pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>

  <modelVersion>4.0.0</modelVersion>

  <parent>
   <groupId>org.gibbo</groupId>
    <artifactId>gibbo-pom</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>child-two</artifactId>
  <packaging>pom</packaging>
  <name>Gibbo Child Two POM</name>

</project>

Command Line

mvn --batch-mode ^
    release:branch ^
    -DautoVersionSubmodules=true ^
    -DupdateBranchVersions=true ^
    -DupdateWorkingCopyVersions=true ^
    -DupdateDependencies=true ^
    -DupdateVersionsToSnapshot=false ^
    -DpushChanges=false ^
    -DremoteTagging=false ^
    -DsuppressCommitBeforeBranch=false ^
    -DbranchName=RELEASE-%1 ^
    -DreleaseVersion=%1 ^
    -DdevelopmentVersion=%2-SNAPSHOT ^
    -DdryRun=true

I've tried specifying all modules independently (with the 
-Dproject.rel.org.gibbo:child-one etc pattern), but the release versions in the 
branch are still overridden incorrectly.




mvn --version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 
2014-06-17T14:51:42+01:00)
Maven home: C:\MyProgramFiles\apache-maven-3.2.2\bin\..
Java version: 1.7.0_60, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_60\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "windows"

git --version
git version 1.9.4.msysgit.1

Maven-release-plugin 2.5
Maven-scm-plugin 1.9.1


Reply via email to