Maven SCM插件使用的svn-settings.xml格式是什么?

3
我正在尝试外部化我的用户名和密码,但似乎 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)

那么,我应该使用的替代品是什么?
1个回答

7
根据Maven SCM集成文档,似乎svn-settings.xml文件仅允许使用以下参数:
  • configDirectory
  • useCygwinPath
  • cygwinMountPath
  • useNonInteractive

如果您不想将密码放在pom.xml中,可以将其作为命令行参数传递。

pom.xml中:

<connectionUrl>scm:svn:http://my_username@my_hostname/im-tools-repos/trunk</connectionUrl>

当调用Maven时:

mvn -Dpassword=my_password scm:status

你是正确的。这意味着我链接的问题的答案最终是错误的。 - Koohoolinn
这个变量名password正确吗?这是SCM插件使用的默认名称吗?我现在正在尝试通过命令行设置我的SVN身份验证信息。 - cringe
是的,用户名和密码用于设置用户凭据。您可以在此处找到SCM插件参数:http://maven.apache.org/scm/plugins/list-mojo.html - Jcs

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接