mvn release:prepare not committing changes to pom.xml
Solution 1
I solved the issue on my side (running maven 3.0.5) by updating the git scm provider dependency, not the release plugin version:
<build>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
The git scm 1.8.1 version correctly makes the git commit (tested with the prepare and rollback goals).
EDIT: Different versions of maven-release-plugin and maven-scm-provider-gitexe may be required depending on your environment. See the comments for more discussion.
Solution 2
I ran into the same problem, solution by #richnou works for me (upgrading SCM dependency).
There is the issue created on this problem, see link below. The problem relates with new version of Git where "git status" returns localized messages which plugin cannot parse. It is the root cause. The issue was fixed in git scm (1.8.1 version) by using --porcelain
option of git (which should return easily parsable output), but after this fix, another problem has raised - if repository root (scm tag) is not the working directory, release:prepare
still fails. This issue seems to be fixed in snapshot version of Git SCM (not released yet). This can be workarounded by copiing scm
tag into child pom.
maven-release-plugin-and-git-fix
Solution 3
Firstly, the answers from richnou and vasekt solved my problem I thought I'd post this answer just because of newer versions than have been mentioned and I thought it would be good to give an extra example including them.
I was running maven release plugin 2.3.2 with Git 3.3.x without specifying the maven scm dependency version, which was causing the snapshot issue. For me I just upgraded to the latest version at the time for both maven release plugin and the scm dependency which were as follows:
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.5</version>
</dependency>
</dependencies>
</plugin>
This worked fine for me, release versions uploaded properly to the release repo and the snapshot worked as expected as well.
Solution 4
You are probably reading this because the above solutions have not worked for you.
I had the same issue and I tried everything mentioned here.
My versions were: maven-release-plugin 2.5
and git 1.7.9
The solution that worked for me was downgrading maven-release-plugin to version 2.3.2
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>
Solution 5
Upgrading the maven-release-plugin
to 2.5.2 helped (upgrading to 2.5 didn’t; it works for some people but not all, possibly depending on other newer software on the system). I believe it automatically pulls in the new provider.
Related videos on Youtube
BumbleGee
Updated on September 11, 2020Comments
-
BumbleGee over 3 years
I'm trying to release a Jenkins plugin (stashNotifier) with Maven and face a problem with the release plugin.
mvn clean release:prepare
runs to completion without errors but fails to commit the changed pom.xml in my local git repository. Even though it does tag the HEAD of the branch on which I'm trying to release version 1.0.2. This is what my local branch looks like before preparing the release
* df60768 (HEAD, origin/develop, develop) upgraded parent pom to version 1.498 * 792766a added distribution management section to pom.xml and amended readme.md
and this is what it looks like after
* df60768 (HEAD, tag: stashNotifier-1.0.2, origin/develop, develop) upgraded parent pom to version 1.498 * 792766a added distribution management section to pom.xml and amended readme.md
Unfortunately, the pom.xml already contains the next development version, which in turn causes a subsequent release:perform to release that snapshot version.
From the command output of maven, it almost looks like it's omitting the git commit command:
[INFO] Checking in modified POMs... [INFO] Executing: /bin/sh -c cd /Users/gruetter/Dropbox/stashNotifier && git add -- pom.xml [INFO] Working directory: /Users/gruetter/Dropbox/stashNotifier [INFO] Executing: /bin/sh -c cd /Users/gruetter/Dropbox/stashNotifier && git status [INFO] Working directory: /Users/gruetter/Dropbox/stashNotifier [INFO] Tagging release with the label stashNotifier-1.0.2... [INFO] Executing: /bin/sh -c cd /Users/gruetter/Dropbox/stashNotifier && git tag -F /var/folders/dr/xxbtyycs1z9dl2_snlj87zrh0000gn/T/maven-scm-678409272.commit stashNotifier-1.0.2 [INFO] Working directory: /Users/gruetter/Dropbox/stashNotifier [INFO] Executing: /bin/sh -c cd /Users/gruetter/Dropbox/stashNotifier && git push [email protected]:jenkinsci/stashnotifier-plugin.git stashNotifier-1.0.2 [INFO] Working directory: /Users/gruetter/Dropbox/stashNotifier [INFO] Executing: /bin/sh -c cd /Users/gruetter/Dropbox/stashNotifier && git ls-files [INFO] Working directory: /Users/gruetter/Dropbox/stashNotifier [INFO] Transforming 'Stash Notifier'... [INFO] Not removing release POMs [INFO] Checking in modified POMs... [INFO] Executing: /bin/sh -c cd /Users/gruetter/Dropbox/stashNotifier && git add -- pom.xml [INFO] Working directory: /Users/gruetter/Dropbox/stashNotifier [INFO] Executing: /bin/sh -c cd /Users/gruetter/Dropbox/stashNotifier && git status [INFO] Working directory: /Users/gruetter/Dropbox/stashNotifier [INFO] Release preparation complete.
I'm running maven 3.0.5 (without --dry-run or -DpushChanges=false). Here are the relevant (I think) parts of my effective pom:
[...] <scm> <connection>scm:git:git://github.com/jenkinsci/stashnotifier-plugin.git</connection> <developerConnection>scm:git:[email protected]:jenkinsci/stashnotifier-plugin.git</developerConnection> <url>https://github.com/jenkinsci/stashnotifier-plugin</url> </scm> [...] <distributionManagement> <repository> <id>maven.jenkins-ci.org</id> <url>http://maven.jenkins-ci.org:8081/content/repositories/releases/</url> </repository> <snapshotRepository> <id>maven.jenkins-ci.org</id> <url>http://maven.jenkins-ci.org:8081/content/repositories/snapshots</url> </snapshotRepository> <site> <id>github-pages</id> <url>gitsite:[email protected]/jenkinsci/maven-site.git:plugin-parent/stashNotifier</url> </site> </distributionManagement> [...] <properties> [...] <maven-release-plugin.version>2.2.2</maven-release-plugin.version> [...] </properties> [...] <build> [...] <pluginManagement> <plugins> [...] <plugin> <artifactId>maven-release-plugin</artifactId> <version>2.2.2</version> </plugin> [...] </pluginManagement> [...] <plugins> [...] <plugin> <artifactId>maven-release-plugin</artifactId> <version>2.2.2</version> <configuration> <goals>deploy</goals> </configuration> </plugin> [...] </plugins> </build>
What am I doing wrong? Thanks in advance for your insights!
-
khmarbaise about 11 yearsUnfortunately i dont see any error message which is related to your decription. Can you show the error messages you get?
-
BumbleGee about 11 yearsThat's the thing; there are no error messages at all. Are you interested in a particular section of the output? (I'd like to avoid bloating the question by appending the multi-page maven command line output)
-
brk3 about 11 yearsI just had the exact same problem and solved it by updating to version 2.4 of maven-release-plugin.
-
Greg Case about 11 yearsI also had the same problem, only I fixed it by downgrading from version 2.4 to 2.3.2. Go figure.
-
John Fear about 9 yearsI also had the problem, but upgrading from 2.4.1 to 2.5.1 solved it for me.
-
-
kevinarpe about 10 yearsThis solved my git issue with maven-release-plugin 2.4.2. Very nice.
-
Les Hazlewood about 10 yearsThis solved the problem for me too - please award the answer to @richnou so he can receive his credit!
-
CAB about 10 yearsdowngrading to 1.7.x also helped me
-
jaydfwtx almost 10 yearsWorks under maven 2.2.1 as well.
-
Jack Leow over 9 yearsIf I could +10, I would, this problem has been driving me nuts for so long.
-
ericbn over 9 years@BumbleGee, you should consider accepting this answer!
-
Sean Connolly over 9 yearsI had
maven-release-plugin-2.3.2
and git v1.9.3 and upgrading tomaven-release-plugin-2.5
fixed it for me. -
Welsh over 9 yearsI had
maven-release-plugin-2.3.1
and git1.9.4
and upgrading tomaven-release-plugin-2.5
also worked for me. -
Chathurika Sandarenu over 9 yearsI also had the same issue. I've maven 3.2.1 and git 1.9.1. Just updating release plugin to 2.5 didn't work for me because the directory I had the pom was not the git root. As richnou suggested I updated the maven-scm-provider-gitexe to latest one which was 1.9.2 and it solved the problem.
-
Laimoncijus about 9 yearsThanks! Had the same issue with release plugin 2.5.1, downgrade to 2.4.2 + git scm 1.8.1 solves the problems!
-
Rudi about 9 yearshad the same problem after we moved the project to git, the plugin was fine when the project was in svn. after adding the maven-scm-provider-gitexe dependency it started to work. thanks!
-
xenoterracide almost 9 yearsinstead of this specific dependency I updated all of it to
<artifactId>maven-scm-plugin</artifactId><version>1.9.4</version>
-
raisercostin over 8 yearsIs fixed in 2.5.2 without the workaround. Thanks for suggesting the solution till 2.5.2.
-
Tobias Hochgürtel over 8 yearsIt's not fixed with <artifactId>maven-release-plugin</artifactId><version>2.5.2</version> and if you define the maven-release-plugin dependency to latest released version (1.9.4) of maven-scm-provider-gitexe . I changed the release-plugin dep.. to 1.8.1 and everything worked nice.
-
kenny over 8 yearsI'll second @TobiasHochgürtel. Combo of 2.5.2 & 1.9.4 still has a bug. 2.5.2 & 1.8.1 seems ok.
-
Tobias Hochgürtel over 8 yearsI asked on Maven Developer Mailinglist for an changed behavior and they hint me to an Jira Issue MRELEASE-812 and my Mailinglist Thread. I hope I can activate some users from here to provide feedback to the maven developers.
-
JBCP over 8 yearsUpgrading the plugin to
2.5.2
solved the problem for me, with git2.4.0
-
demaniak over 8 yearsDid exactly as the this answer - solved my problems. 5 hours of struggle I'm not getting back. Thanks maven/git/gitlab.
-
Innokenty over 8 yearsJust ti note: for me just 2.5 was enough.
-
Sven Ackermann almost 8 yearsI still had the problem that the changes in the POMs were not commited with Maven 3.3.1, maven-release-plugin 2.4.1 and maven-scm-provider-gitexe 1.9. Updating to maven-release-plugin 2.5.3 and maven-scm-provider-gitexe 1.9.4 solved the issue.
-
Steven R. Loomis almost 8 yearsperhaps it's a git version / mvn version interlock issue. Why does the latest maven (3.3.9) still default the release plugin to 2.3.2? Is this a maven bug? maven.apache.org/ref/3.3.9/maven-model-builder/super-pom.html
-
Schmick over 7 yearsI had this same problem for a multi-module project using Maven 3.0.4, and didn't have a block for the maven-release-plugin in my parent pom.xml at all. I added the block you show above to the parent pom.xml, updated the maven-release-plugin version to 2.5.2, left maven-scm-provider-gitexe at 1.8.1, and it fixed my problem. Thank you!
-
andrzej.szmukala almost 7 years
-
colini over 6 yearsIn my case I only had to upgrade maven-release-plugin to 2.5.3. It wasn't necessary to specify the gitexe dependency.
-
Avec almost 6 yearsRunning Maven 3.5.2. I am using maven-release-plugin 2.5.3 and maven-scm-plugin 1.9.5, but had to add dependency maven-scm-provider-gitexe 1.8.1, to the release-plugin. No other combinations I tried worked for me.
-
Avec almost 6 yearsMaven 3.5.2, Maven-release-plugin 2.5.3 + provider 1.9.5 does not commit the pom's after mvn release:prepare for me. provider 1.8.1 does however.
-
Avec almost 6 yearsUpdate to my comment above. This only work for one pom and no submodules. If submodules the poms is not commited.
-
Avec almost 6 yearsUpdate to my comment above. 1.8.1 works for commiting single pom project but not for multi module projects.
-
Avec almost 6 years
-
spujap over 3 yearsThis issue is relevant in 2020, I got the exact problem in Spring boot 2.3.1 project and git version 2.27.0 and this solution proposed by richnou fixed it. Also I added the <scm> tag in format as desired by Spring boot 2.3.1