【问题标题】:Gradle fails to resolve spring dependencyGradle 无法解决 spring 依赖
【发布时间】:2015-05-10 23:52:42
【问题描述】:

我正在尝试使用以下 build.gradle 文件构建我的项目。

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath('org.springframework.boot:spring-boot-gradle-plugin:1.2.1.RELEASE')
    }
}

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'

repositories {
    maven {
        url 'https://repo.spring.io/milestone'
    }
    mavenCentral()
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-data-mongodb:1.2.2.RELEASE')
    compile('org.springframework.data:spring-data-mongodb:1.7.0.RC1')

    compile('org.springframework.cloud:spring-cloud-spring-service-connector')
    compile('org.springframework.cloud:spring-cloud-cloudfoundry-connector')

    compile 'org.springframework:spring-test:4.1.5.RELEASE'
    compile 'de.grundid.opendatalab:geojson-jackson:1.3'
    compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.5.1'
    compile 'org.apache.httpcomponents:httpclient:4.4'

    testCompile('junit:junit')
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}

我添加了里程碑存储库,因为我需要 spring-data-mongodb 1.7.0.RC1 依赖项。但是,parent-poms 的引用似乎有问题,因为 gradle 无法获取以下依赖项:org.springframework.data.build:spring-data-parent:1.6.0.RC1

它退出并出现以下错误:

Could not find org.springframework.data.build:spring-data-parent:1.6.0.RC1.
Searched in the following locations:
    https://repo.spring.io/milestone/org/springframework/data/build/spring-data-parent/1.6.0.RC1/spring-data-parent-1.6.0.RC1.pom
    https://repo.spring.io/milestone/org/springframework/data/build/spring-data-parent/1.6.0.RC1/spring-data-parent-1.6.0.RC1.jar
    https://repo1.maven.org/maven2/org/springframework/data/build/spring-data-parent/1.6.0.RC1/spring-data-parent-1.6.0.RC1.pom
    https://repo1.maven.org/maven2/org/springframework/data/build/spring-data-parent/1.6.0.RC1/spring-data-parent-1.6.0.RC1.jar

gradlew build --debug 命令的输出可以在这里找到:http://pastebin.com/seYRMFQP

该命令还向标准输出产生了以下输出:http://pastebin.com/atcWQsKF

我已经尝试清理我的本地 gradle 缓存,但没有解决问题。

【问题讨论】:

    标签: maven gradle spring-data parent-pom


    【解决方案1】:

    您在构建中定义的存储库似乎不包含您正在寻找的库。但似乎该库在 jcenter 中可用。要添加 jcenter,请将以下 sn-p 添加到您的 build.gradle 文件中:

    repositories {
        jcenter()
    }
    

    干杯, 勒内

    【讨论】:

      【解决方案2】:

      很抱歉给您带来不便,该工件目前错放在release 存储库中,但它应该在milestone 中。

      我们会尽快将其移至里程碑。在此之前,请将发布存储库 url 'https://repo.spring.io/release' 添加到您的构建中。

      【讨论】:

      • 工件已被移动,现在可通过里程碑存储库获得。
      • 现在build.gradle文件中需要采取什么形式?
      猜你喜欢
      • 1970-01-01
      • 2017-04-10
      • 1970-01-01
      • 1970-01-01
      • 2019-01-27
      • 2018-05-13
      • 2021-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多