每次连接到存储库时,凭据都存储在.subversion目录(UNIX系统)下的用户主文件夹中。反正是不是这样做,或者至少在命令行下指定另一个目录--config-dir选项?
我做了一个小小的hack,暂时改变了user.home java属性,但这在Windows上不起作用。
提前致谢,
瑞
答案 0 :(得分:1)
其中一个createDefaultAuthenticationManager()
实现允许这样做。
这是org.tmatesoft.svn.core.wc.SVNWCUtil
中的静态方法。
以下是https://svnkit.com/javadoc/
的说明public static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir,java.lang.String userName,java.lang.String password,boolean storeAuth)
创建使用提供的配置目录和用户凭据的默认身份验证管理器。 storeAuth参数影响使用auth存储。
参数:
configDir - 运行时配置区域的新位置
userName - 用户名称
密码 - 用户的密码
storeAuth - 如果为true,则启用auth存储,否则禁用
返回:
证书和服务器配置驱动程序接口的默认实现
所以,你可以做类似的事情。
...set up repository...
File configDir = new File("MyFolder");
ISVNAuthenticationManager auth;
auth = SVNWCUtil.createDefaultAuthenticationManager(
configDir, user, password, false );
repository.setAuthenticationManager(auth);