Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用SVN工具包jar将文件添加并提交到SVN中_Java_Svn - Fatal编程技术网

Java 使用SVN工具包jar将文件添加并提交到SVN中

Java 使用SVN工具包jar将文件添加并提交到SVN中,java,svn,Java,Svn,实际上,我想将源代码提交到svn中。我需要将新文件添加并提交到svn存储库中,并使用以下代码。代码正常工作,但无法提交到SVN String urls = "http://192.168.0.19/svn/cadgraf/Branch/Jobs"; final String url = urls+File.separator+l_users.getSelectedValue().toString()+File.separator+"Active"; System.out.

实际上,我想将源代码提交到svn中。我需要将新文件添加并提交到svn存储库中,并使用以下代码。代码正常工作,但无法提交到SVN

    String urls = "http://192.168.0.19/svn/cadgraf/Branch/Jobs";
    final String url = urls+File.separator+l_users.getSelectedValue().toString()+File.separator+"Active";
    System.out.println("svn url------>"+url);
    final String destPath = "/home/dev702/Desktop/Jobs-test/Tempfiles";
    SVNRepository repository = null;
    setupLibrary();
    try {
        //initiate the reporitory from the url
        repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
        //create authentication data
        ISVNAuthenticationManager authManager =
                SVNWCUtil.createDefaultAuthenticationManager("xxxxxx", "xxxxxx");
        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 ourClientManager = SVNClientManager.newInstance();
        ourClientManager.setAuthenticationManager(authManager);
        //use SVNUpdateClient to do the export
        SVNCommitClient commitClient = ourClientManager.getCommitClient();
        commitClient.setIgnoreExternals(false);
    commitClient.doCommit(new File[]{new File(destPath)}, false, "Commit message", null, null, false, false, SVNDepth.INFINITY);
        SVNCommitClient client = new SVNCommitClient(authManager, null); 
         SVNCommitInfo info; 
         info = client.doCommit( new File[]{new File(destPath)}, false, "Commit message", null, null, false, false, SVNDepth.INFINITY);
    } catch (SVNException e) {
        e.printStackTrace();
    } finally {
        System.out.println("Done");
    }

代码工作正常,但不会将文件提交到SVN。

是否仍有导入到SVN的方法?我也可以。。请建议是否有其他方法使用javaJava专家回答plz提交或导入到svn…我自己找到了导入的解决方案为什么不使用您得到的解决方案更新您的问题?这样,像我这样正在寻找相同问题的人可以得到帮助。