Maven-Release-Plugin:强制使用 scm 提供程序的特定版本

2024-02-08

我正在尝试将我们的存储库从 SVN 迁移到 Git,但在一个非常大的项目上使用发布插件时遇到了问题。

Problem:

该项目大约有 50 多个子模块,它尝试将所有修改后的 poms 添加为一个“git add --”。这打破了Windows命令行的限制。

幸运的是,在 maven-scm-provider-gitexe 的 1.8.1 版本中对此进行了修复,但是 maven-release-plugin 目前设置为使用没有修复的 1.7。

我尝试将以下内容添加到我的根 pom.xml 中,但我仍然可以看到它在 mvn release:prepare 期间下载 1.7,甚至在详细模式下运行该进程也没有表明它正在使用 1.8.1。

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.3.2</version>
    <executions>
      <execution>
        <id>default</id>
        <goals>
          <goal>perform</goal>
        </goals>
        <configuration>
          <pomFileName>subproj/pom.xml</pomFileName>
        </configuration>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven.scm</groupId>
        <artifactId>maven-scm-api</artifactId>
        <version>1.8.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.maven.scm</groupId>
        <artifactId>maven-scm-provider-gitexe</artifactId>
        <version>1.8.1</version>
      </dependency>
    </dependencies>
  </plugin>

我还尝试将以下内容添加到 pom.xml 中,以防强制它使用正确的版本而不再幸运。

<extensions>
    <extension>
      <groupId>org.apache.maven.scm</groupId>
      <artifactId>maven-scm-provider-gitexe</artifactId>
      <version>1.8.1</version>
    </extension>
</extensions>    

我怀疑它没有使用 1.8.1 的原因是它仍然无法尝试对所有 pom 文件进行 git add,而我已经检查了插件源代码,它看起来肯定应该为 Windows 单独添加每个文件(我甚至仔细检查了 codehaus plexus Os.isFamily(Os.FAMILY_WINDOWS) 以确保在我的机器上返回 true。

我缺少什么?如何强制发布插件使用正确版本的 scm 插件?


根据maven发布插件2.4.1更新日志,由于“git status --porcelain”的错误,SCM 在此版本中已回退到 1.7。

  • 所以你应该尝试2.4版本。它应该可以工作,也许您不会受到该错误的影响。
  • 或者等待未来的版本...

编辑 : 该错误与此 SCM 错误相关:http://jira.codehaus.org/browse/SCM-686 http://jira.codehaus.org/browse/SCM-686

有评论说要使用maven-scm-provider-gitexe AND maven-scm-provider-git-commons作为依赖项

<dependencies>
    <dependency>
      <groupId>org.apache.maven.scm</groupId>
      <artifactId>maven-scm-provider-gitexe</artifactId>
      <version>1.8.1</version>
    </dependency>
   <dependency>
    <groupId>org.apache.maven.scm</groupId>
    <artifactId>maven-scm-provider-git-commons</artifactId>
    <version>1.8.1</version>
   </dependency>       
</dependencies>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Maven-Release-Plugin:强制使用 scm 提供程序的特定版本 的相关文章

随机推荐