Gradle:找不到org.codehaus.groovy:groovy:1.0.0

时间:2018-12-15 18:58:52

标签: java gradle groovy

我正在使用gradle编译我的Groovy和Java代码。今天,我更新了groovy 2.5.4并将gradle升级到了版本5。

gradle run命令现在失败,并显示此错误消息。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileGroovy'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
   > Could not find org.codehaus.groovy:groovy:1.0.0.
     Searched in the following locations:
       - https://jcenter.bintray.com/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.pom
       - https://jcenter.bintray.com/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.jar
       - http://repository.apache.org/snapshots/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.pom
       - http://repository.apache.org/snapshots/org/codehaus/groovy/groovy/1.0.0/groovy-1.0.0.jar
     Required by:
         project :

* Try:

这是 build.gradle 文件。

plugins {
    id 'groovy'
    id 'application'
}

repositories {
    jcenter()
      maven {
        url "http://repository.apache.org/snapshots/"
    }
}

dependencies {
    // Use the latest Groovy version for building this library
    implementation 'org.codehaus.groovy:groovy-all:2.5.4'
    compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
    compile group: 'commons-io', name: 'commons-io', version: '2.6'
    compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
    compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.6.1'
    compile group: 'org.apache.directory', name: 'groovyldap', version: '0.1-SNAPSHOT'
    // https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
    compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
    // https://mvnrepository.com/artifact/org.apache.directory.shared/shared-ldif
    compile group: 'org.apache.directory.shared', name: 'shared-ldif', version: '0.9.19'
    // https://mvnrepository.com/artifact/org.apache.directory.api/api-ldap-model
    compile group: 'org.apache.directory.api', name: 'api-ldap-model', version: '1.0.0-M15'
    // https://mvnrepository.com/artifact/com.opencsv/opencsv
    compile group: 'com.opencsv', name: 'opencsv', version: '4.0'
    // https://mvnrepository.com/artifact/org.jsoup/jsoup
    compile group: 'org.jsoup', name: 'jsoup', version: '1.11.2'
    compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.11'

    // https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc
    compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.4.0.jre8'
    // https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds
    compile group: 'net.sourceforge.jtds', name: 'jtds', version: '1.3.1'
    // https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
    compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
 // https://mvnrepository.com/artifact/org.yaml/snakeyaml
    compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'

    // https://mvnrepository.com/artifact/com.rubiconproject.oss/jchronic
    compile group: 'com.rubiconproject.oss', name: 'jchronic', version: '0.2.8'

    compile group: 'io.github.http-builder-ng', name: 'http-builder-ng-core', version: '1.0.3'

    // Use the awesome Spock testing and specification framework
    testImplementation 'org.spockframework:spock-core:1.2-groovy-2.5'
}

// Define the main class for the application
mainClassName = 'ssl.test.App'

有任何帮助来解决此错误消息吗?

谢谢 SR

1 个答案:

答案 0 :(得分:0)

您可以将groovyldap依赖项声明替换为以下内容(如@ paul-king在评论中所述):

    compile(group: 'org.apache.directory', name: 'groovyldap', version: '0.1-SNAPSHOT') {
        exclude group: 'groovy', module: 'groovy'
    }

这至少将帮助您摆脱依赖性解析错误。

我不知道您的groovyldap依赖项是否仍然可以在Groovy 2.5.4中使用,但是绝对值得一试。