Hello,
thank you, but I don't get it to work.
I've tried to different approaches to successfully connect to the SVN repo:

*** ONE ***
try {
        String repo = "https://path/path";;
        DAVRepositoryFactory.setup();
        SVNURL url = SVNURL.parseURIDecoded(repo);
        final SvnOperationFactory svnOperationFactory = new 
SvnOperationFactory();
        final ISVNAuthenticationManager authenticationManager =
SVNWCUtil.createDefaultAuthenticationManager();
        svnOperationFactory.setAuthenticationManager(authenticationManager);
        try {
                final SvnCheckout checkout = 
svnOperationFactory.createCheckout();
                checkout.setSource(SvnTarget.fromURL(url));
                checkout.setSingleTarget(SvnTarget.fromFile(new 
File("C:\target")));
                checkout.run();
        } finally {
                svnOperationFactory.dispose();
        }
} catch (SVNException e) {
        e.printStackTrace();
}


*** TWO ***
String repo = "https://path/path";;
DAVRepositoryFactory.setup();
File auth = new File("C:\\...\\auth");
ISVNAuthenticationManager authManager =
SVNWCUtil.createDefaultAuthenticationManager(auth);
SVNURL url = SVNURL.parseURIDecoded(repo);
SVNRepository repository = SVNRepositoryFactory.create(url,null);
repository.setAuthenticationManager(authManager);
System.err.println(repository.getLatestRevision());

Both result in

org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001:
Authentication required for '<https://xxx:443> Subversion Server on ABC'
        at
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:47)
        at
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:41)
        at
org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:186)
        at
org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:654)
        at
[...]


What's wrong with the snippets? What do I have to change? On the console,
I can work with the SVN command line interface because the credentials are
stored in the folder "C:\\...\\auth".


Thank you.

Regards
Michael




> Hello Michael,
> To create an authentication manager that uses settings from ~/.subversion
> directory use
> SVNWCUtil#createDefaultAuthenticationManager.
>
> If you want to look at credential that it provides --- usually one haven't
> to look at those
> credentials --- use ISVNAuthenticationProvider#getFirstAuthentication
> ISVNAuthenticationProvider#getNextAuthentication.  SVNAuthentication class
> (and its subclasses) is
> an abstraction for credentials.
>
> The most common code to use :
>
> final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
> final ISVNAuthenticationManager authenticationManager =
> SVNWCUtil.createDefaultAuthenticationManager();
> svnOperationFactory.setAuthenticationManager(authenticationManager);
> try {
>     // any operations,
>     final SvnCheckout checkout = svnOperationFactory.createCheckout();
>     checkout.setSource(SvnTarget.fromURL(url));
>     checkout.setSingleTarget(SvnTarget.fromFile(workingCopyDirectory));
>     checkout.run();
>
> } finally {
>     svnOperationFactory.dispose();
> }
>
> --
> Dmitry Pavlenko,
> TMate Software,
> http://subgit.com/ - git-svn bridge
>
>> Hello,
>>
>> having a "ISVNAuthenticationProvider authenticationProvider", how can I
>> get credentials to be used to access a Subversion repository with a
>> command like "svn --username YYY --password XXX status". In other words,
>> I'd like to re-use stored credentials dynamically to access a repo, but
>> I'm not sure how to do it. Background: I'm inside a build server plugin,
>> which uses the SVNKit.
>>
>>
>> Thank you.
>>
>>
>> Regards
>> Michael
>
>


Reply via email to