当我尝试执行
mvn release: perform
时,出现此错误
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: E215004: Authentication failed and interactive prompting is disabled; see the --force-interactive option
svn: E215004: Commit failed (details follow):
svn: E215004: No more credentials or we tried too many times.
Authentication failed
svn: E215004: Additional errors:
svn: E215004: No more credentials or we tried too many times.
Authentication failed
所以我认为我的 pom 可能有问题。所以我尝试做
mvn scm:checkin -Dmessage="relase" -Dusername=<username> -Dpassword=<password>.
我以这种方式在pom中有scm相关部分:
<scm>
<url>url</url>
<connection>scm:svn:url</connection>
<developerConnection>scm:svn:url</developerConnection>
</scm>
但我仍然遇到同样的错误。
我在 eclipse 中安装了 subclipse。我的机器上安装了 collabnet 和 tortoise SVN。都是1.8.1版本。当我尝试使用 Team--> Commit 直接从 eclipse 签入时,我能够使用相同的凭据进行提交。我还可以使用 TortoiseSVN 的相同凭据进行提交。但使用相同的凭据,我无法从 Maven 释放执行或 scm 签入。我看到一些关于 ${user.home}.scm\svn-settings.xml 的链接,我们可以在其中配置交互式 svn。但我在我的机器上看不到它。我没有看到 .scm 文件夹本身。我在这里做错了什么吗?
这些是我在eclipse中安装的软件
Collabnet 合并客户端-4.0.2 子剪辑- 1.10.4 Subclipse 客户端适配器-1.10.1 Subversion JavaHL 本机库适配器 - 1.8.8.1
我唯一看到此文档的地方是 Maven 发布插件常见问题解答。您可以将
server
条目添加到 POM,然后配置项目以使用它。
<!-- Project POM, or a corporate parent -->
<properties>
<project.scm.id>my-scm-server<project.scm.id>
</properties>
<!-- User's settings.xml file -->
<server>
<id>my-scm-server</id>
<username>username</username>
<password>password</password> <!-- encrypted I hope! -->
</server>
我找不到这方面的参考资料(也许我看过源代码),但从前我发现,如果你将ID设置为Subversion主机,那么服务器信息将被许多插件定位,包括发布和供应链管理。它看起来像这样:
<!-- Project POM, or a corporate parent -->
<properties>
<project.scm.id>your.subversion.host<project.scm.id> <!-- note, no scm:svn part -->
</properties>
<!-- User's settings.xml file -->
<server>
<id>your.subversion.host</id>
<username>username</username>
<password>password</password> <!-- encrypted I hope! -->
</server>
Subversion 确实从 1.6.x 更改为 1.8.x。这个问题可能是由于这个原因(特别是使用 Windows + Active Directory)。
如果从 eclipse 调用 maven,它会尝试不使用 Subclipse 访问 SVN。假设您甚至使用外部 Maven 安装。此外部安装不知道您的 Eclipse/Subclipse,因此会调用您平台上可用的 SVN(取决于 Windows 路径变量)。该 SVN 不知道您的 Eclipse,因此必须从其他地方获取凭据(例如 %USER%\AppData\Roaming\Subversion uth)。不幸的是,自 SVN 协议版本 1.6 以来,maven-release-plugin 似乎已经破坏了一些东西。
目前尚无最佳解决方案,也不清楚到底是什么原因导致 maven-release-plugin 失败。最好的解决方法可能是在 Eclipse Run 配置中提供凭据(JRE 选项卡,然后参数 Dusername=... -Dpassword=...)。
我建议不要将凭据存储在可能会被其他人意外利用的地方。