3

我正在尝试将我的用户名和密码外部化,但svn-settings.xml的格式似乎不正确。我在网上找不到任何资源,除了这里的这篇文章和下面给出的错误。

在我的 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)

那么,我应该使用什么来代替?

4

1 回答 1

7

根据 maven SCM 集成文档,svn-settings.xml 文件似乎只允许这些参数:

  • 配置目录
  • 使用 CygwinPath
  • cygwinMountPath
  • 使用非交互式

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

在 pom.xml 中:

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

在调用 maven 时:

mvn -Dpassword=my_password scm:status
于 2010-09-01T14:20:02.157 回答