如何为用户名/密码设置svnant / svnkit提示符

时间:2022-03-10 23:53:25

I have an Ant script that needs to checkout a directory from Subversion. This works using svnant/svnkit. However, Subversion access is authenticated, and I do not want to store my user password in a file.

我有一个Ant脚本需要从Subversion签出一个目录。这适用于使用svnant / svnkit。但是,Subversion访问已通过身份验证,我不想将用户密码存储在文件中。

Can I make svnkit pop up a password dialog? Or even better, make it use the same credential caching that subversive/svnkit inside of Eclipse uses (the username can be read from the build.properties)?

我可以让svnkit弹出密码对话框吗?或者甚至更好,让它使用与Eclipse内部的subversive / svnkit相同的凭证缓存(可以从build.properties中读取用户名)?

I cannot switch to public key based authentication, as I do not control the subversion server.

我无法切换到基于公钥的身份验证,因为我不控制subversion服务器。

Right now, it just says "svn: authentication cancelled".

现在,它只是说“svn:authentication cancelled”。

4 个解决方案

#1


4  

An analog to this answer:

这个答案类似于:

<input message="password:>" addproperty="password">
      <handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>

This will make it so that the person's username is not displayed. This requires Ant 1.7.1 or greater.

这将使得不显示该人的用户名。这需要Ant 1.7.1或更高版本。

#2


3  

To answer my own question, I can use the Ant [input] task to ask the user for a password and store it in a property that can be passed to the [svn] task.

要回答我自己的问题,我可以使用Ant [input]任务向用户询问密码并将其存储在可以传递给[svn]任务的属性中。

 <target name="checkout">
    <input
        message="Please enter subversion password for ${username}:"
        addproperty="password"
      />

    <svn svnkit="${svnkit}" username="${username}" password="${password}">
        <checkout url="${urlRepos}/project" destPath="web/" />
    </svn> 
</target>

Unfortunately, this does not mask the password with * * * * *, and I still want to read from the credential cache...

不幸的是,这不会用* * * * *掩盖密码,我仍然想从凭证缓存中读取...

#3


2  

The Jera Ant Tasks provide a [query] task that supports password input:

Jera Ant Tasks提供支持密码输入的[query]任务:

<taskdef name="query" classname="com.jera.anttasks.Query" />
<target name="checkout">
  <query
    message="Please enter subversion password for ${username}:"
    name="password"  password="true"
  />

  <svn svnkit="${svnkit}" username="${username}" password="${password}">
    <checkout url="${urlRepos}/project" destPath="web/" />
  </svn> 
</target>

#4


1  

Use ant-dialog (http://sourceforge.net/projects/ant-dialog/), it can display a java awt window so you can input properties. It also features a *** password like input field type.

使用ant-dialog(http://sourceforge.net/projects/ant-dialog/),它可以显示一个java awt窗口,以便您可以输入属性。它还具有输入字段类型的***密码。

#1


4  

An analog to this answer:

这个答案类似于:

<input message="password:>" addproperty="password">
      <handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>

This will make it so that the person's username is not displayed. This requires Ant 1.7.1 or greater.

这将使得不显示该人的用户名。这需要Ant 1.7.1或更高版本。

#2


3  

To answer my own question, I can use the Ant [input] task to ask the user for a password and store it in a property that can be passed to the [svn] task.

要回答我自己的问题,我可以使用Ant [input]任务向用户询问密码并将其存储在可以传递给[svn]任务的属性中。

 <target name="checkout">
    <input
        message="Please enter subversion password for ${username}:"
        addproperty="password"
      />

    <svn svnkit="${svnkit}" username="${username}" password="${password}">
        <checkout url="${urlRepos}/project" destPath="web/" />
    </svn> 
</target>

Unfortunately, this does not mask the password with * * * * *, and I still want to read from the credential cache...

不幸的是,这不会用* * * * *掩盖密码,我仍然想从凭证缓存中读取...

#3


2  

The Jera Ant Tasks provide a [query] task that supports password input:

Jera Ant Tasks提供支持密码输入的[query]任务:

<taskdef name="query" classname="com.jera.anttasks.Query" />
<target name="checkout">
  <query
    message="Please enter subversion password for ${username}:"
    name="password"  password="true"
  />

  <svn svnkit="${svnkit}" username="${username}" password="${password}">
    <checkout url="${urlRepos}/project" destPath="web/" />
  </svn> 
</target>

#4


1  

Use ant-dialog (http://sourceforge.net/projects/ant-dialog/), it can display a java awt window so you can input properties. It also features a *** password like input field type.

使用ant-dialog(http://sourceforge.net/projects/ant-dialog/),它可以显示一个java awt窗口,以便您可以输入属性。它还具有输入字段类型的***密码。