【发布时间】:2020-11-10 07:35:12
【问题描述】:
为了使用 Vault 为 Spring Cloud Config 服务器和(Java 和非 Java)客户端组合一个示例项目,我决定采用多模块 Gradle 构建的路线。由于我已经有两个工作 Java 项目(服务器和客户端),我想我可以将公共配置拉到父 build.gradle 并有条件地为 Java 子项目应用配置。我从服务器子项目开始,遇到了一个我无法解决的问题。
父模块的build.gradle 如下所示:
plugins {
id 'org.springframework.boot' version '2.3.0.RELEASE' apply false
id 'io.spring.dependency-management' version '1.0.9.RELEASE' apply false
id 'idea'
}
ext {
set('springCloudVersion', "Hoxton.SR4")
}
allprojects {
repositories {
mavenCentral()
}
version = '0.0.1-SNAPSHOT'
}
subprojects {
// We'll need dependencies for Docker and Docker compose
afterEvaluate { project ->
if (project.usesSpringBoot) {
println("Configuring ${springCloudVersion}")
configure(project) {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
group = 'com.daecabhir'
sourceCompatibility = '11'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
useJUnitPlatform()
}
}
}
}
}
build.gradle 的 cloud-config-server 子项目看起来像:
ext {
usesSpringBoot = true
}
不幸的是,尝试 ./gradlew build 给我一个错误,它无法从 Spring Cloud Config 中找到一个类:
/home/gwright/projects/cloud-config-vault-example/cloud-config-server/src/main/java/com/daecabhir/cloudconfigserver/CloudConfigServerApplication.java:5: error: package org.springframework.cloud.config.server does not exist
import org.springframework.cloud.config.server.EnableConfigServer;
^
/home/gwright/projects/cloud-config-vault-example/cloud-config-server/src/main/java/com/daecabhir/cloudconfigserver/CloudConfigServerApplication.java:7: error: cannot find symbol
@EnableConfigServer
^
symbol: class EnableConfigServer
2 errors
当我检查依赖项时,我得到以下编译时间:
compileClasspath - Compile classpath for source set 'main'.
+--- org.springframework.boot:spring-boot-starter-actuator -> 2.3.0.RELEASE
| +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE
| | +--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (c)
| | +--- io.micrometer:micrometer-core:1.5.1 (c)
| | +--- org.springframework:spring-web:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-webmvc:5.2.6.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-actuator:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-json:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-tomcat:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-autoconfigure:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-logging:2.3.0.RELEASE (c)
| | +--- jakarta.annotation:jakarta.annotation-api:1.3.5 (c)
| | +--- org.springframework:spring-core:5.2.6.RELEASE (c)
| | +--- org.yaml:snakeyaml:1.26 (c)
| | +--- org.springframework.boot:spring-boot-actuator:2.3.0.RELEASE (c)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.0 (c)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.0 (c)
| | +--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.0 (c)
| | +--- org.apache.tomcat.embed:tomcat-embed-core:9.0.35 (c)
| | +--- org.glassfish:jakarta.el:3.0.3 (c)
| | +--- org.apache.tomcat.embed:tomcat-embed-websocket:9.0.35 (c)
| | +--- org.springframework:spring-beans:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-aop:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-context:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-expression:5.2.6.RELEASE (c)
| | +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0 (c)
| | +--- com.fasterxml.jackson.core:jackson-core:2.11.0 (c)
| | +--- ch.qos.logback:logback-classic:1.2.3 (c)
| | +--- org.apache.logging.log4j:log4j-to-slf4j:2.13.2 (c)
| | +--- org.slf4j:jul-to-slf4j:1.7.30 (c)
| | +--- org.springframework:spring-jcl:5.2.6.RELEASE (c)
| | +--- org.springframework.security:spring-security-crypto:5.3.2.RELEASE (c)
| | +--- ch.qos.logback:logback-core:1.2.3 (c)
| | +--- org.slf4j:slf4j-api:1.7.30 (c)
| | \--- org.apache.logging.log4j:log4j-api:2.13.2 (c)
| +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- org.springframework.boot:spring-boot:2.3.0.RELEASE
| | | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | | +--- org.springframework:spring-core -> 5.2.6.RELEASE
| | | | \--- org.springframework:spring-jcl:5.2.6.RELEASE
| | | \--- org.springframework:spring-context -> 5.2.6.RELEASE
| | | +--- org.springframework:spring-aop:5.2.6.RELEASE
| | | | +--- org.springframework:spring-beans:5.2.6.RELEASE
| | | | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | | +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
| | | +--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | | \--- org.springframework:spring-expression:5.2.6.RELEASE
| | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-autoconfigure:2.3.0.RELEASE
| | | +--- org.springframework.boot:spring-boot:2.3.0.RELEASE (*)
| | | \--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter-logging:2.3.0.RELEASE
| | | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | | +--- ch.qos.logback:logback-classic -> 1.2.3
| | | | +--- ch.qos.logback:logback-core:1.2.3
| | | | \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | | +--- org.apache.logging.log4j:log4j-to-slf4j -> 2.13.2
| | | | +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | | | \--- org.apache.logging.log4j:log4j-api:2.13.2
| | | \--- org.slf4j:jul-to-slf4j -> 1.7.30
| | | \--- org.slf4j:slf4j-api:1.7.30
| | +--- jakarta.annotation:jakarta.annotation-api -> 1.3.5
| | +--- org.springframework:spring-core -> 5.2.6.RELEASE (*)
| | \--- org.yaml:snakeyaml -> 1.26
| +--- org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | \--- org.springframework.boot:spring-boot-actuator:2.3.0.RELEASE
| | \--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| \--- io.micrometer:micrometer-core -> 1.5.1
| \--- org.hdrhistogram:HdrHistogram:2.1.12
+--- org.springframework.boot:spring-boot-starter-web -> 2.3.0.RELEASE
| +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (*)
| +--- org.springframework.boot:spring-boot-starter-json:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (*)
| | +--- org.springframework:spring-web -> 5.2.6.RELEASE
| | | +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
| | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | +--- com.fasterxml.jackson.core:jackson-databind -> 2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0
| | | \--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8 -> 2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | | \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310 -> 2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | | \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names -> 2.11.0
| | +--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
| +--- org.springframework.boot:spring-boot-starter-tomcat:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- jakarta.annotation:jakarta.annotation-api -> 1.3.5
| | +--- org.apache.tomcat.embed:tomcat-embed-core -> 9.0.35
| | +--- org.glassfish:jakarta.el -> 3.0.3
| | \--- org.apache.tomcat.embed:tomcat-embed-websocket -> 9.0.35
| | \--- org.apache.tomcat.embed:tomcat-embed-core:9.0.35
| +--- org.springframework:spring-web -> 5.2.6.RELEASE (*)
| \--- org.springframework:spring-webmvc -> 5.2.6.RELEASE
| +--- org.springframework:spring-aop:5.2.6.RELEASE (*)
| +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
| +--- org.springframework:spring-context:5.2.6.RELEASE (*)
| +--- org.springframework:spring-core:5.2.6.RELEASE (*)
| +--- org.springframework:spring-expression:5.2.6.RELEASE (*)
| \--- org.springframework:spring-web:5.2.6.RELEASE (*)
\--- org.springframework.cloud:spring-cloud-starter-config -> 2.2.2.RELEASE
+--- org.springframework.cloud:spring-cloud-starter:2.2.2.RELEASE
| +--- org.springframework.boot:spring-boot-starter:2.2.5.RELEASE -> 2.3.0.RELEASE (*)
| +--- org.springframework.cloud:spring-cloud-context:2.2.2.RELEASE
| | \--- org.springframework.security:spring-security-crypto:5.2.2.RELEASE -> 5.3.2.RELEASE
| +--- org.springframework.cloud:spring-cloud-commons:2.2.2.RELEASE
| | \--- org.springframework.security:spring-security-crypto:5.2.2.RELEASE -> 5.3.2.RELEASE
| \--- org.springframework.security:spring-security-rsa:1.0.9.RELEASE
| \--- org.bouncycastle:bcpkix-jdk15on:1.64
| \--- org.bouncycastle:bcprov-jdk15on:1.64
+--- org.springframework.cloud:spring-cloud-config-client:2.2.2.RELEASE
| +--- org.springframework.boot:spring-boot-autoconfigure:2.2.5.RELEASE -> 2.3.0.RELEASE (*)
| +--- org.springframework.cloud:spring-cloud-commons:2.2.2.RELEASE (*)
| +--- org.springframework.cloud:spring-cloud-context:2.2.2.RELEASE (*)
| +--- org.springframework:spring-web:5.2.4.RELEASE -> 5.2.6.RELEASE (*)
| +--- com.fasterxml.jackson.core:jackson-annotations:2.10.2 -> 2.11.0
| \--- com.fasterxml.jackson.core:jackson-databind:2.10.2 -> 2.11.0 (*)
\--- com.fasterxml.jackson.core:jackson-databind:2.10.2 -> 2.11.0 (*)
表面上看起来很合理,但事实并非如此。 Gradle 似乎尊重依赖关系,但依赖管理并没有完全解决它们。当我回退到使用以下父 build.gradle 完全指定 cloud-config-server 子项目中的配置时:
plugins {
id 'org.springframework.boot' version '2.3.0.RELEASE' apply false
id 'io.spring.dependency-management' version '1.0.9.RELEASE' apply false
id 'idea'
}
ext {
set('springCloudVersion', "Hoxton.SR4")
}
allprojects {
repositories {
mavenCentral()
}
version = '0.0.1-SNAPSHOT'
}
还有一个子项目build.gradle:
plugins {
id 'org.springframework.boot'
id 'io.spring.dependency-management'
id 'java'
}
group = 'com.daecabhir'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-config-server'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
useJUnitPlatform()
}
构建工作正常,并且依赖关系得到更充分的“解决”(尤其是 spring-cloud-config-server 依赖关系):
compileClasspath - Compile classpath for source set 'main'.
+--- org.springframework.boot:spring-boot-starter-web -> 2.3.0.RELEASE
| +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE
| | +--- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.0 (c)
| | +--- org.springframework:spring-web:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-webmvc:5.2.6.RELEASE (c)
| | +--- org.springframework.security:spring-security-crypto:5.3.2.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-actuator:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-json:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-tomcat:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-validation:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE (c)
| | +--- org.yaml:snakeyaml:1.26 (c)
| | +--- org.springframework.boot:spring-boot:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-autoconfigure:2.3.0.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-starter-logging:2.3.0.RELEASE (c)
| | +--- jakarta.annotation:jakarta.annotation-api:1.3.5 (c)
| | +--- org.springframework:spring-core:5.2.6.RELEASE (c)
| | +--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (c)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.0 (c)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.0 (c)
| | +--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.0 (c)
| | +--- org.apache.tomcat.embed:tomcat-embed-core:9.0.35 (c)
| | +--- org.glassfish:jakarta.el:3.0.3 (c)
| | +--- org.apache.tomcat.embed:tomcat-embed-websocket:9.0.35 (c)
| | +--- org.springframework:spring-beans:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-aop:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-context:5.2.6.RELEASE (c)
| | +--- org.springframework:spring-expression:5.2.6.RELEASE (c)
| | +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0 (c)
| | +--- org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.0.RELEASE (c)
| | +--- io.micrometer:micrometer-core:1.5.1 (c)
| | +--- org.hibernate.validator:hibernate-validator:6.1.5.Final (c)
| | +--- org.slf4j:slf4j-api:1.7.30 (c)
| | +--- org.apache.httpcomponents:httpclient:4.5.12 (c)
| | +--- org.apache.httpcomponents:httpcore:4.4.13 (c)
| | +--- com.fasterxml.jackson.core:jackson-core:2.11.0 (c)
| | +--- ch.qos.logback:logback-classic:1.2.3 (c)
| | +--- org.apache.logging.log4j:log4j-to-slf4j:2.13.2 (c)
| | +--- org.slf4j:jul-to-slf4j:1.7.30 (c)
| | +--- org.springframework:spring-jcl:5.2.6.RELEASE (c)
| | +--- org.springframework.boot:spring-boot-actuator:2.3.0.RELEASE (c)
| | +--- jakarta.validation:jakarta.validation-api:2.0.2 (c)
| | +--- org.jboss.logging:jboss-logging:3.4.1.Final (c)
| | +--- com.fasterxml:classmate:1.5.1 (c)
| | +--- commons-codec:commons-codec:1.14 (c)
| | +--- ch.qos.logback:logback-core:1.2.3 (c)
| | \--- org.apache.logging.log4j:log4j-api:2.13.2 (c)
| +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- org.springframework.boot:spring-boot:2.3.0.RELEASE
| | | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | | +--- org.springframework:spring-core -> 5.2.6.RELEASE
| | | | \--- org.springframework:spring-jcl:5.2.6.RELEASE
| | | \--- org.springframework:spring-context -> 5.2.6.RELEASE
| | | +--- org.springframework:spring-aop:5.2.6.RELEASE
| | | | +--- org.springframework:spring-beans:5.2.6.RELEASE
| | | | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | | +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
| | | +--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | | \--- org.springframework:spring-expression:5.2.6.RELEASE
| | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-autoconfigure:2.3.0.RELEASE
| | | +--- org.springframework.boot:spring-boot:2.3.0.RELEASE (*)
| | | \--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter-logging:2.3.0.RELEASE
| | | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | | +--- ch.qos.logback:logback-classic -> 1.2.3
| | | | +--- ch.qos.logback:logback-core:1.2.3
| | | | \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | | +--- org.apache.logging.log4j:log4j-to-slf4j -> 2.13.2
| | | | +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| | | | \--- org.apache.logging.log4j:log4j-api:2.13.2
| | | \--- org.slf4j:jul-to-slf4j -> 1.7.30
| | | \--- org.slf4j:slf4j-api:1.7.30
| | +--- jakarta.annotation:jakarta.annotation-api -> 1.3.5
| | +--- org.springframework:spring-core -> 5.2.6.RELEASE (*)
| | \--- org.yaml:snakeyaml -> 1.26
| +--- org.springframework.boot:spring-boot-starter-json:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (*)
| | +--- org.springframework:spring-web -> 5.2.6.RELEASE
| | | +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
| | | \--- org.springframework:spring-core:5.2.6.RELEASE (*)
| | +--- com.fasterxml.jackson.core:jackson-databind -> 2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0
| | | \--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8 -> 2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | | \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310 -> 2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0
| | | +--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | | \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names -> 2.11.0
| | +--- com.fasterxml.jackson.core:jackson-core:2.11.0
| | \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
| +--- org.springframework.boot:spring-boot-starter-tomcat:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | +--- jakarta.annotation:jakarta.annotation-api -> 1.3.5
| | +--- org.apache.tomcat.embed:tomcat-embed-core -> 9.0.35
| | +--- org.glassfish:jakarta.el -> 3.0.3
| | \--- org.apache.tomcat.embed:tomcat-embed-websocket -> 9.0.35
| | \--- org.apache.tomcat.embed:tomcat-embed-core:9.0.35
| +--- org.springframework:spring-web -> 5.2.6.RELEASE (*)
| \--- org.springframework:spring-webmvc -> 5.2.6.RELEASE
| +--- org.springframework:spring-aop:5.2.6.RELEASE (*)
| +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
| +--- org.springframework:spring-context:5.2.6.RELEASE (*)
| +--- org.springframework:spring-core:5.2.6.RELEASE (*)
| +--- org.springframework:spring-expression:5.2.6.RELEASE (*)
| \--- org.springframework:spring-web:5.2.6.RELEASE (*)
\--- org.springframework.cloud:spring-cloud-config-server -> 2.2.2.RELEASE
+--- org.springframework.cloud:spring-cloud-config-client:2.2.2.RELEASE
| +--- org.springframework.boot:spring-boot-autoconfigure:2.2.5.RELEASE -> 2.3.0.RELEASE (*)
| +--- org.springframework.cloud:spring-cloud-commons:2.2.2.RELEASE
| | \--- org.springframework.security:spring-security-crypto:5.2.2.RELEASE -> 5.3.2.RELEASE
| +--- org.springframework.cloud:spring-cloud-context:2.2.2.RELEASE
| | \--- org.springframework.security:spring-security-crypto:5.2.2.RELEASE -> 5.3.2.RELEASE
| +--- org.springframework:spring-web:5.2.4.RELEASE -> 5.2.6.RELEASE (*)
| +--- com.fasterxml.jackson.core:jackson-annotations:2.10.2 -> 2.11.0
| \--- com.fasterxml.jackson.core:jackson-databind:2.10.2 -> 2.11.0 (*)
+--- org.springframework.boot:spring-boot-starter-actuator:2.2.5.RELEASE -> 2.3.0.RELEASE
| +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (*)
| +--- org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.0.RELEASE
| | +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| | \--- org.springframework.boot:spring-boot-actuator:2.3.0.RELEASE
| | \--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| \--- io.micrometer:micrometer-core -> 1.5.1
| \--- org.hdrhistogram:HdrHistogram:2.1.12
+--- org.springframework.boot:spring-boot-starter-web:2.2.5.RELEASE -> 2.3.0.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-validation:2.2.5.RELEASE -> 2.3.0.RELEASE
| +--- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE (*)
| +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (*)
| +--- org.glassfish:jakarta.el -> 3.0.3
| \--- org.hibernate.validator:hibernate-validator -> 6.1.5.Final
| +--- jakarta.validation:jakarta.validation-api:2.0.2
| +--- org.jboss.logging:jboss-logging:3.3.2.Final -> 3.4.1.Final
| \--- com.fasterxml:classmate:1.3.4 -> 1.5.1
+--- org.springframework.security:spring-security-crypto:5.2.2.RELEASE -> 5.3.2.RELEASE
+--- org.springframework.security:spring-security-rsa:1.0.9.RELEASE
| \--- org.bouncycastle:bcpkix-jdk15on:1.64
| \--- org.bouncycastle:bcprov-jdk15on:1.64
+--- org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
| +--- com.jcraft:jsch:0.1.54
| +--- com.jcraft:jzlib:1.1.1
| +--- com.googlecode.javaewah:JavaEWAH:1.1.6
| \--- org.slf4j:slf4j-api:1.7.2 -> 1.7.30
+--- org.eclipse.jgit:org.eclipse.jgit.http.apache:5.1.3.201810200350-r
| +--- org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r (*)
| +--- org.apache.httpcomponents:httpclient:4.5.5 -> 4.5.12
| | +--- org.apache.httpcomponents:httpcore:4.4.13
| | \--- commons-codec:commons-codec:1.11 -> 1.14
| \--- org.apache.httpcomponents:httpcore:4.4.9 -> 4.4.13
+--- org.yaml:snakeyaml:1.25 -> 1.26
\--- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.10.2 -> 2.11.0
+--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
+--- org.yaml:snakeyaml:1.26
\--- com.fasterxml.jackson.core:jackson-core:2.11.0
所以我的问题是,我需要做什么才能能够根据属性有选择地指定父项目中的配置,以便完全解决依赖关系?我如何指定导致它无法完全解决依赖关系的配置是什么?
FWIW,该项目的完整代码可以在这里找到:
【问题讨论】:
-
为了澄清,
cloud-config-client和cloud-config-server应该是 same 多项目构建的一部分? -
最终,是的。现在只有
cloud-config-server包含在settings.gradle中。我要
标签: spring spring-boot gradle spring-cloud-config