更新,然后用java代码提交到svn

时间:2014-04-28 13:39:49

标签: java svn

*大家好 我刚开始使用SVNkit并尝试使用它的功能。 我想首先获取特定目录的更新,然后将其提交到svn中。 但我遇到了问题。 更新代码

public class TestSVNConnection {
    public static void main(String[] args) {

        DAVRepositoryFactory.setup();    
        FSRepositoryFactory.setup();
                SVNRepositoryFactoryImpl.setup();
        //This is a general way how to creates an SVNRepository driver object:
        File dstPath = new File("C:/Users/Testcases/NEWFrameWork/src/de/eb/test/generic/destinationentry/");
        String url = "http://subversion/svn/navi/TestTools/work/somu8950/NEWFrameWork/src/de/eb/test/generic/destinationentry";
        String username = "username";
        String password= "password";        
        SVNRepository repository = null;
        ISVNAuthenticationManager authManager=null;

        try {
            repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
            ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
            authManager = SVNWCUtil.createDefaultAuthenticationManager(username, password);
            repository.setAuthenticationManager(authManager);
            //output some data to verify connection
            System.out.println("Repository Root: " + repository.getRepositoryRoot(true));
            System.out.println("Repository UUID: " + repository.getRepositoryUUID(true));
            //need to identify latest revision
            long latestRevision = repository.getLatestRevision();
            System.out.println("Repository Latest Revision: " + latestRevision);
            //create client manager and set authentication
            SVNClientManager cm = SVNClientManager.newInstance(options,authManager);


            //use SVNUpdateClient to do the update
            SVNUpdateClient uc = cm.getUpdateClient();
            long[] l =  uc.doUpdate(new File[]{dstPath}, SVNRevision.HEAD,SVNDepth.INFINITY, true,true);
           System.out.println("update is done ....  :) :)" +l[0]);*

}

但在这里我收到错误

Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.RecognitionException 
at line  :
    long[] l =  uc.doUpdate(new File[]{dstPath}, SVNRevision.HEAD,SVNDepth.INFINITY, true,true);
           System.out.println("update is done ....  :) :)" +l[0]);*     

即使我已准备好Commit的代码 它也不起作用。

请有人帮我这个或分享一段代码。

提前致谢。

0 个答案:

没有答案