【发布时间】:2017-12-31 18:24:44
【问题描述】:
我们正在将我们的项目从 SVN 迁移到 Git。我们使用 Maven 发布插件到 mvn release:prepare 和 mvn release:perform 我们的包。
除此之外,我们正在修改 pom.xml 文件的 scm 属性以指向我们的 git 存储库。
但是,当我们运行mvn release:prepare 时出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project MyProject: Unable to check for local modifications
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] 'svn' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
为什么它还在尝试执行 cmd.exe /X /C "svn --non-interactive status" ?
还需要配置什么才能在此发布过程中完全迁移?
我的 pom.xml 上下文详细信息:
<scm>
<connection>scm:git:https://myGitProjectUrl.git</connection>
<developerConnection>scm:git:https://myGitProjectUrl.git</developerConnection>
<url>https://myGitProjectUrl</url>
</scm>
...
<build>
<plugins>
<!-- Maven Release Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<goals>deploy</goals>
</configuration>
</plugin>
【问题讨论】:
-
您能否确认您是否在正确的 git 项目和带有 git scm URL 的 pom 文件中?
-
@RishikeshDarandale,好问题。是的,我现在已经检查了三次以确保。我从包含 pom.xml 的本地文件夹中运行命令,该文件夹是正确的项目并且匹配适当的 git repo。
-
嗯,一切看起来都不错。能否请您尝试将插件版本更新为
2.5.3? -
请在 pluginManagement 中定义 maven-release-plugin 而不仅仅是您所做的...除此之外,您是否尝试从命令行或像 Jenkins 这样的 CI 解决方案调用它?在 Windows/Linux 上工作?请显示运行的完整日志输出......是的顺便说一句。尝试使用 2.5.3 的 maven-release-plugin...
-
@user944849 我刚刚确认此项目中没有其他 pom.xml 文件声明了 scm 属性。唯一的包含在父 pom 中,它们都引用了 git repos。
标签: git maven maven-release-plugin