gpt4 book ai didi

maven - mvn 发布 :prepare not committing changes to pom. xml

转载 作者:行者123 更新时间:2023-12-03 05:18:27 25 4
gpt4 key购买 nike

我正在尝试使用 Maven 发布 Jenkins 插件 ( stashNotifier ),但遇到了发布插件的问题。

mvn clean release:prepare

运行完成,没有错误,但无法将更改后的 pom.xml 提交到我的本地 git 存储库中。即使它确实标记了我试图发布版本 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已经包含了下一个开发版本,这又会导致后续的release:perform发布该快照版本。

从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。请参阅评论以进行更多讨论。

关于maven - mvn 发布 :prepare not committing changes to pom. xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15166781/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com