无法解析org.springframework.cloud:spring-cloud-starter-config

时间:2018-07-31 09:19:52

标签: gradle spring-cloud-config

我正在使用gradle构建,这是我的build.gradle

gradle文件中是否缺少任何内容

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/libs-milestone" }
    maven { url "https://repo.spring.io/libs-snapshot" }     
}

apply plugin: 'org.springframework.boot'
apply plugin: 'java'
apply plugin: 'javac2'
apply plugin: 'docker'

dependencies {
   compile project(':services')
   compile 'org.springframework.boot:spring-boot-starter-web'
   compile('org.springframework.cloud:spring-cloud-starter-config')
   compile('org.springframework.boot:spring-boot-starter-actuator')
   compile 'org.jetbrains:annotations:13.0'
   runtime 'org.aspectj:aspectjweaver'

   testCompile 'junit:junit'
   testCompile 'org.springframework.boot:spring-boot-starter-test'
   testRuntime "com.jayway.awaitility:awaitility:$awaitilityVersion"
   testRuntime 'com.jayway.jsonpath:json-path'
}

apply plugin: 'java'

springBoot {
executable = true
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Finchley.BUILD-SNAPSHOT"
}
}

docker {
baseImage "java:8"
}

task buildDocker(type: Docker, dependsOn: build) {
applicationName = "ldp-data-fetcher"
exposePort(8080)
addFile("${buildDir}/libs/app-0.1-SNAPSHOT.jar", "/opt/jmg/app-0.1-SNAPSHOT.jar")
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

1 个答案:

答案 0 :(得分:1)

尝试使用:

dependencies { 
  [...]
  compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-config', version: '2.0.1.RELEASE'
}

而不是:

compile('org.springframework.cloud:spring-cloud-starter-config')