-1

My task is to list all the files present in a SVN directory for a given url.

 DAVRepositoryFactory.setup();
 Collection entries = repository.getDir(path, -1, null, (Collection)null);
 Iterator iterator = entries.iterator();
 while(iterator.hasNext()){
  SVNEntry entry = (SVNDirEntry)iterator.next();
  println(entry.getName());
}

while executing the code I am getting below error:

java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "oracle.xml.parser.v2.XMLNode.getChildNodes()Lorg/w3c/dom/NodeList;" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, oracle/xml/parser/v2/XMLNode, and the class loader (instance of ) for interface org/w3c/dom/Node have different Class objects for the type getChildNodes used in the signature

I have added this jar files to the project, "XMlParserv2", "XMLSchema".

I am unable to figure out how to resolve this, Can anyone have any solution for this, or any code samples for this task?

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110

1 Answers1

1

I never got that error. Try this:

@Grab('org.tmatesoft.svnkit:svnkit:1.8.11')

import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory
import org.tmatesoft.svn.core.SVNURL
import org.tmatesoft.svn.core.io.SVNRepositoryFactory
import org.tmatesoft.svn.core.wc.SVNWCUtil
import org.tmatesoft.svn.core.SVNException
import org.tmatesoft.svn.core.SVNProperties

try {
    def files = getSVNFiles('http://svn.svnkit.com/repos/svnkit/trunk', '', 'anonymous', 'anonymous')
    println files
} catch (SVNException e) { 
    // Do something useful 
}

List<String> getSVNFiles(String url, String path, String name, String password) throws SVNException {
    SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url)).with {    
        authenticationManager = SVNWCUtil.createDefaultAuthenticationManager(name, password)

        return getDir(path, -1, new SVNProperties(), [])*.name
    }
}
Emmanuel Rosa
  • 9,697
  • 2
  • 14
  • 20