svn – 无法在Android Studio gradle中导入org.tmatesoft

这里有各种帖子显示从tmatesoft导入svnkit,如下所示,这在CLI中运行良好,但在
Android Studio中,同步和运行都会导致导入错误org.tmatesoft.svn.cli.SVN;

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        classpath group: 'org.tmatesoft.svnkit', name: 'svnkit', version: '1.7.11'
    }
}

import org.tmatesoft.svn.cli.SVN;

project.ext.SVN = SVN;

def _disableSystemExitCall = {
    System.setSecurityManager(
            new SecurityManager() {
                @Override public void checkPermission(java.security.Permission perm) {}
                @Override public void checkExit(int status) { throw new SecurityException(); }
            }
    );
};



def _enableSystemExitCall = { System.setSecurityManager(null); };

/* for certain scenarios might be useful to share these closures with build */
project.ext.disableSystemExitCall = _disableSystemExitCall;
project.ext.enableSystemExitCall = _enableSystemExitCall;

project.ext.doSvnMain = { String... aSvnArgs ->
    _disableSystemExitCall(); /* stop SVN.main from doing a System.exit call */
    try {
        SVN.main( aSvnArgs as String[] );
    } finally {
        _enableSystemExitCall();
    }
} ;

task AAAA << {
    doSvnMain( 'info', "mySVNUrl" );
}

运用
Gradle – distributionUrl = https://services.gradle.org/distributions/gradle-2.2.1-all.zip
Android Studio – 1.0.2

最佳答案 根据
this search,在org.tmatesoft.svnkit组织的任何包中都没有类org.tmatesoft.svn.cli.SVN.

旧组织org.tmate的svnkit-cli很久以前曾经拥有它,但不是新版本和新组织.

另外,你使用的artifact-id是错误的,它应该是svnkit-cli.总而言之,这就是依赖声明:

compile 'org.tmatesoft.svnkit:svnkit-cli:1.8.7' //newer version that the one you looked for.

你需要的课程是:

org.tmatesoft.svn.cli.svn.SVNCheckoutCommand
org.tmatesoft.svn.cli.svn.SVNCommandEnvironment
org.tmatesoft.svn.cli.svn.SVNDeleteCommand
点赞