Sunday, April 3, 2016

Checkout with SVNKIT on UNIX - Solving SVN authentication error E170001

Prefix

I'm writing this post since I've seen many encountered this error without an answer including myself and SVNKIT documentation is not at best, for example:


Problem

The following code will run okay in case you in the windows and working in the domain same as the SVN but will not work on UNIX platforms


SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
SvnCheckout svnCheckout = svnOperationFactory.createCheckout();
svnCheckout.setSingleTarget(SvnTarget.fromFile(checkoutFolder));
svnCheckout.setSource(SvnTarget.fromURL(url));
svnCheckout.run();

Solution:

Add the following line after creating the SvnOperationFactory


svnOperationFactory.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(username, password.toCharArray()));

Complete code should look like this:

SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
svnOperationFactory.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(username, password.toCharArray()));
SvnCheckout svnCheckout = svnOperationFactory.createCheckout();
svnCheckout.setSingleTarget(SvnTarget.fromFile(checkoutFolder));
svnCheckout.setSource(SvnTarget.fromURL(url));
svnCheckout.run();

No comments:

Post a Comment