我正在尝试外部化我的用户名和密码,但似乎 svn-settings.xml 的格式不正确。除了这篇帖子here之外,我在网上找不到任何资源,然后发出错误。
在我的pom.xml中,我得到了
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
...
<configuration>
<connectionUrl>scm:svn:http://my_hostname/im-tools-repos/trunk</connectionUrl>
<checkoutDirectory>${project.build.directory}/checkout/im-tools</checkoutDirectory>
</configuration>
</execution>
</executions>
</plugin>
在C:\ Documents and Settings \ my_uid.scm \ svn-settings.xml中我得到了
<svn-settings>
<user>my_uid</user>
<password>my_pwd</password>
</svn-settings>
当我运行Maven时,它会失败并显示以下消息:
C:\Documents and Settings\my_uid\.scm\svn-settings.xml isn't well formed. SKIPPED.Unrecognised tag: 'user' (position: START_TAG seen <svn-settings>\r\n\t<user>... @2:7)
[INFO] Executing: cmd.exe /X /C "svn --non-interactive checkout http://my_hostname/im-tools-repos/trunk C:\test\bamboo\agent\target\checkout\im-tools"
[INFO] Working directory: C:\test\bamboo\agent\target\checkout
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: OPTIONS of 'http://my_hostname/im-tools-repos/trunk': authorization failed: Could not authenticate to server: rejected Basic challenge (http://my_hostname)
那么,我应该使用什么而不是 ?
答案 0 :(得分:7)
根据maven SCM集成documentation,似乎svn-settings.xml文件只允许这些参数:
如果您不想将密码放在pom.xml中,可以将其作为命令行参数传递
在pom.xml中:
<connectionUrl>scm:svn:http://my_username@my_hostname/im-tools-repos/trunk</connectionUrl>
在调用maven时:
mvn -Dpassword=my_password scm:status