mvn版本:准备不提交对pom.xml的更改 [英] mvn release:prepare not committing changes to pom.xml

查看:102
本文介绍了mvn版本:准备不提交对pom.xml的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Maven发行一个Jenkins插件( stashNotifier )并遇到问题与发布插件.

I'm trying to release a Jenkins plugin (stashNotifier) with Maven and face a problem with the release plugin.

mvn clean release:prepare

运行到完成而没有错误,但是无法在我的本地git存储库中提交更改的pom.xml.即使它确实标记了我要发布版本1.0.2的分支的HEAD.这是我的本地分支在准备发布之前的样子

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 

这就是之后的样子

* 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已经包含了下一个开发版本,这反过来又导致了后续发行版:执行该快照版本.

Unfortunately, the pom.xml already contains the next development version, which in turn causes a subsequent release:perform to release that snapshot version.

从maven的命令输出中,几乎就像省略了git commit命令:

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 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的相关部分(我认为):

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: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>

我做错了什么?预先感谢您的见解!

What am I doing wrong? Thanks in advance for your insights!

推荐答案

我通过更新git scm提供程序依赖项而不是发行插件版本来解决我的问题(运行maven 3.0.5):

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>

git scm 1.8.1版本正确地进行了git提交(已测试了prepare和rollback目标).

The git scm 1.8.1 version correctly makes the git commit (tested with the prepare and rollback goals).

根据您的环境,可能需要不同版本的maven-release-plugin和maven-scm-provider-gitexe.请参阅评论以获取更多讨论.

Different versions of maven-release-plugin and maven-scm-provider-gitexe may be required depending on your environment. See the comments for more discussion.

这篇关于mvn版本:准备不提交对pom.xml的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆