SVNKit (JavaSVN) 是一个纯 Java 的 SVN 客户端库,使用 SVNKit 无需安装任何 SVN 的客户端,支持各种操作系统。
这是一款商业软件,非商业可免费使用。
重要步骤:
1、连接指定的svn库
String url = "http://svn.svnkit.com/repos/svnkit/trunk/doc";
String name = "anonymous";
String password = "anonymous";
SVNRepository repository = null;
try {
repository = SVNRepositoryFactory.create( SVNURL.parseURIDecoded( url ) );
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( name , password );
repository.setAuthenticationManager( authManager );
} catch ( SVNException svne ) {
//handle exception
}
2、获取指定路径的目录和文件列表