mvn release : pom.xml에 대한 변경 사항을 커밋하지 않도록 준비
Maven 으로 Jenkins 플러그인 ( stashNotifier ) 을 릴리스하려고하는데 릴리스 플러그인 에 문제가 있습니다.
mvn clean release:prepare
오류없이 완료되지만 로컬 git 저장소에서 변경된 pom.xml을 커밋하지 못합니다. 버전 1.0.2를 릴리스하려는 분기의 HEAD에 태그를 지정하더라도. 이것은 릴리스를 준비하기 전에 내 로컬 지점의 모습입니다.
* df60768 (HEAD, origin/develop, develop) upgraded parent pom to version 1.498
* 792766a added distribution management section to pom.xml and amended readme.md
그리고 이것은 이후의 모습입니다
* 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
안타깝게도 pom.xml에는 이미 다음 개발 버전이 포함되어 있으며, 이로 인해 후속 릴리스가 수행됩니다.
maven의 명령 출력에서 거의 git commit 명령을 생략 한 것처럼 보입니다.
[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 git@github.com: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.
maven 3.0.5를 실행하고 있습니다 (--dry-run 또는 -DpushChanges = false 제외). 내 효과적인 pom의 관련 (내 생각에) 부분은 다음과 같습니다.
[...]
<scm>
<connection>scm:git:git://github.com/jenkinsci/stashnotifier-plugin.git</connection>
<developerConnection>scm:git:git@github.com: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:git@github.com/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>
내가 도대체 뭘 잘못하고있는 겁니까? 귀하의 통찰력에 미리 감사드립니다!
릴리스 플러그인 버전이 아닌 git scm 공급자 종속성을 업데이트하여 내 편 (maven 3.0.5 실행)에서 문제를 해결했습니다.
<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>
git scm 1.8.1 버전은 git 커밋을 올바르게 만듭니다 (준비 및 롤백 목표로 테스트 됨).
편집 : 환경에 따라 다른 버전의 maven-release-plugin 및 maven-scm-provider-gitexe가 필요할 수 있습니다. 더 많은 논의를 위해 코멘트를보십시오.
나는 같은 문제에 부딪쳤다. #richnou의 해결책이 나를 위해 일한다 (SCM 의존성 업그레이드). 이 문제에 대해 생성 된 문제가 있습니다. 아래 링크를 참조하십시오. 문제는 "git status"가 플러그인을 구문 분석 할 수없는 현지화 된 메시지를 반환하는 새 버전의 Git과 관련이 있습니다. 근본 원인입니다. 이 문제는 git --porcelain
옵션 (쉽게 구문 분석 가능한 출력을 반환해야 함 )을 사용하여 git scm (1.8.1 버전)에서 수정되었지만,이 수정 후 저장소 루트 (scm 태그)가 작업 디렉토리가 아닌 경우 또 다른 문제가 발생했습니다. release:prepare
여전히 실패합니다. 이 문제는 Git SCM의 스냅 샷 버전 (아직 출시되지 않음)에서 수정 된 것으로 보입니다. scm
태그를 자식 pom 에 복사하면이 문제를 해결할 수 있습니다 .
maven-release-plugin-and-git-fix
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>
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.
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.
I just ran into this same problem, and from the other answers and comments, figured it was likely a bug in the release plugin itself.
In my case, I was using version 2.4 of the plugin with git in a new-and-mostly-empty project structured as follows:
my-repo.git/
module-parent/ # running the release from here
(module-child-1/) # except I hadn't created it yet
(module-child-2/) # except I hadn't created it yet
(The source code for this project can be seen here, before resolving the problem: my project with the same problem.)
Looking at the release notes for maven-release-plugin:2.4.1, it seemed like perhaps MRELEASE-830 had a shot of resolving it.
I'm not sure if that actually was the problem, but upgrading my project to 2.4.1 of the plugin resolved it for me. Hope it resolves the problem for you, too!
I encountered this same problem when using cygwin+maven+git. It showed no errors but did not attempt to commit the pom changes, just stopped after git status
:
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git status"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Tagging release with the label portal-automation-0.3.9...
[INFO] Executing: cmd.exe /X /C "git tag -F C:\cygwin64\tmp\maven-scm-1212196933.commit portal-automation-0.3.9"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git push git@barrel.mitre.org:org-mitre-caasd/portal-automation.git portal-automation-0.3.9"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git ls-files"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Transforming 'portal-automation'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git status"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Release preparation complete.
As you can see, no errors, just didn't commit after checking status. However when I ran from windows command prompt instead:
...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git status"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\Users\ltheisen\AppData\Local\Temp\maven-scm-2030091036.commit pom.xml"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Executing: cmd.exe /X /C "git push git@barrel.mitre.org:org-mitre-caasd/portal-automation.git master:master"
[INFO] Working directory: C:\Users\ltheisen\git\caasd-portal-automation
[INFO] Release preparation complete.
You can see that it did commit after checking the status. Not sure if this is your issue as well, but it worked for me.
Note that this would mean you need to install msysgit
I'm using Git 1.8.x locally and ran into similar problem:
maven-scm-plugin does
$ git add
$ git status
but no
$ git commit
Use another machine with Git 1.7.x helped me to work around this issue.
Note: I tried using maven-scm-plugin 1.8.1 or 1.9, maven-release-plugin 2.4.1 or 2.4.2.
Similar issue, but I had this problem, using Jenkins Release Plugin and Gitlab:
- First time it worked.
- Second time it wouldn't commit.
Turns out we had a typo in SCM config in our pom.xml, so the Project with typo got created on the first time. At the second time, Maven was accessing the outdated project and complained, not committing the changes.
참고URL : https://stackoverflow.com/questions/15166781/mvn-releaseprepare-not-committing-changes-to-pom-xml
'IT TIP' 카테고리의 다른 글
자식은 다른 저장소를 병합합니까? (0) | 2020.10.16 |
---|---|
Eclipse : Java 1.7 (언 바운드 라이브러리)에 대한 좌절 (0) | 2020.10.16 |
Python NumPy에서 차원과 축이란 무엇입니까? (0) | 2020.10.16 |
주어진 URL로 이미지가 있는지 확인하는 방법은 무엇입니까? (0) | 2020.10.16 |
"@Transactional"은 어디에 서비스 레이어 또는 DAO가 있어야합니까? (0) | 2020.10.16 |