gradle无法在maven存储库

时间:2015-07-08 06:11:01

标签: java maven gradle

我正在做一个简单的gradle构建,我已经将一个特定的工件部署到我的内部sonatype maven repo

我的build.gradle文件如下所示:

apply plugin: 'java'

sourceCompatibility = 1.8
version = '1.0'

repositories {
    mavenCentral()
    maven {url "http://maven.ebay.com/nexus/content/repositories/sre-snapshots/"}
}

dependencies {
    compile group: "com.typesafe", name: "config", version: "1.3.0"
    //compile project(':metrics')
    compile group: 'com.ebay.telemetry', name: 'client-library', version: '0.1-SNAPSHOT'
    compile group: "org.slf4j", name: "slf4j-jdk14", version: "1.7.12"
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

我在命令行上运行此命令:gradle build

我收到此错误:

> Could not find net.alchim31:metrics-influxdb:0.7.1-ebay-SNAPSHOT.
Searched in the following locations:
https://repo1.maven.org/maven2/net/alchim31/metrics-influxdb/0.7.1-ebay-SNAPSHOT/maven-metadata.xml
http://maven.ebay.com/nexus/content/repositories/sre-snapshots/net/alchim31/metrics-influxdb/0.7.1-ebay-SNAPSHOT/maven-metadata.xml
  http://maven.ebay.com/nexus/content/repositories/sre-snapshots/net/alchim31/metrics-influxdb/0.7.1-ebay-SNAPSHOT/metrics-influxdb-0.7.1-ebay-20150708.054833-4.pom
  http://maven.ebay.com/nexus/content/repositories/sre-snapshots/net/alchim31/metrics-influxdb/0.7.1-ebay-SNAPSHOT/metrics-influxdb-0.7.1-ebay-20150708.054833-4.jar

然而,当我去http://maven.ebay.com/nexus/content/repositories/sre-snapshots/net/alchim31/metrics-influxdb/0.7.1-ebay-SNAPSHOT/

我看到以下文件:

  1. 度量-influxdb-0.7.1-易趣-20150708.054830-3.pom
  2. 度量-influxdb-0.7.1-易趣-20150708.054830-3.jar
  3. 当我的repo有metrics-Influxdb-0.7.1-ebay-20150708.054830-3.jar

    时,为什么gradle会寻找metrics-Influxdb-0.7.1-ebay-20150708.054833-4.jar?

1 个答案:

答案 0 :(得分:0)

除了您在上面展示的那个之外,您似乎已经声明了另一个依赖关系。它应该看起来像这样:

compile group: 'net.alchim31', name: 'metrics-influxdb', version: '0.7.1-ebay-SNAPSHOT'

如果找到此依赖关系声明,您可能还会找到问题的根源。

第二种可能性是,你的maven-metadata.xml(在http://maven.ebay.com/nexus/content/repositories/sre-snapshots/net/alchim31/metrics-influxdb/0.7.1-ebay-SNAPSHOT/maven-metadata.xml)搞砸了并指向不存在的构建4。