fix maven-release-plugin not committing changed pom.xml when using git repository

With one of my projects I just had the problem that the maven-release-plugin did not work as expected: I did a mvn release:prepare, answered the questions about the version number of the release and the next snapshot version, but the release plugin did not work as expected:

The version in the pom.xml was updated to the release version, the pom.xml was added to git stage, but not committed. After that, the new tag was created on the version that had still the pom.xml with the SNAPSHOT release, and the mvn release:perform was not building the release version, but still the snapshot version.

I don’t know wether this is a bug in the git version, the maven-release-plugin or the maven-scm-provider, but setting the maven components to the following fix versions (at the moment the actual ones to be found in maven central) solved the problem for me:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.2</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>1.9.4</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

 

Update of maven module version reference to parent pom

In a multi-module maven project the poms of the modules refer to the parent pom by using the parent’s version number. The module’s version normally will be taking from the parent pom. If the parent’s version changes, all the modules poms must be updated to reflect this change. This can be automatically done with the command:

mvn -N versions:update-child-modules