How to get all files and directories from the SVN repository using java

后端 未结 2 1690
执念已碎
执念已碎 2021-01-14 21:07

I have a task to complete. I Want to connect to SVN repository and have to download all directories and files from svn to my local system using java code. I am new to this a

2条回答
  •  生来不讨喜
    2021-01-14 21:29

    "Authentication required" problem means that the server requires authentication but you didn't provide correct ISVNAuthenticationManager implementation to SVNClientManager. SVNKit supports different ways of authentication.

    If you know what your credentials are, and they are fixed, you can use BasicAuthenticationManager implementation.

    If you want to use credentials, stored in your ~/.subversion directory, use DefaultSVNAuthenticationManager implementation (there's a convenient method to construct it:SVNWCUtil.createDefaultAuthenticationManager() but note that this corresponds to Subversion commands with --non-interactive option). Look at SVNCommandEnvironment#createClientAuthenticationManager() implementation if you need authentication manager that would allow to enter password from console.

    And finally I'd like to notice that SVNClientManager is a part of obsolete (though still supported). Instead prefer SvnOperationFactory class like in my another answer, it also has setAuthenticationManager() setter.

    I'm one of SVNKit developers if this matters.

提交回复
热议问题