Skip to content

Commit

Permalink
Use dependency manager to simplify dependency versions #166
Browse files Browse the repository at this point in the history
  • Loading branch information
yidongnan committed Jan 3, 2019
1 parent 9233c1e commit 57e0866
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 26 deletions.
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ buildscript {
nettyTCNativeVersion = '2.0.17.Final'

springBootVersion = '2.0.6.RELEASE'
springSecurityVersion = '5.0.9.RELEASE'
springCloudVersion = 'Finchley.SR2'
springCloudSleuthVersion = '2.0.2.RELEASE'
springCloudConsulVersion = '2.0.1.RELEASE'
springCloudEurekaVersion = '2.0.2.RELEASE'
braveInstrumentationGrpc = '5.5.0'
jUnitVersion = '5.3.1'

Expand Down Expand Up @@ -57,7 +53,7 @@ allprojects {
apply plugin: 'eclipse'
apply plugin: "io.spring.dependency-management"
apply plugin: 'com.diffplug.gradle.spotless'

compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -144,6 +140,18 @@ allprojects {
maven { url 'http://repo.spring.io/plugins-release' }
maven { url "https://plugins.gradle.org/m2/" }
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
}
}

ext {
springSecurityVersion = dependencyManagement.importedProperties['spring-security.version']
springFrameworkVersion = dependencyManagement.importedProperties['spring-framework.version']

This comment has been minimized.

Copy link
@yidongnan

yidongnan Jan 3, 2019

Author Collaborator

@ST-DDT All projects use spring boot and spring cloud dependencyManagement, we can get the dependent version directly from dependencyManagement, how do you think this way? #166

}
}
}

Expand Down
14 changes: 7 additions & 7 deletions grpc-client-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ version = "${projectVersion}"
compileJava.dependsOn(processResources)

dependencies {
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor:${springBootVersion}")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}")
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")

compile project(':grpc-common-spring-boot')
compile("org.springframework.boot:spring-boot-starter:${springBootVersion}")
compileOnly("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth:${springCloudSleuthVersion}")
compileOnly("org.springframework.cloud:spring-cloud-starter-consul-discovery:${springCloudConsulVersion}")
compileOnly("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:${springCloudEurekaVersion}")
compile("org.springframework.boot:spring-boot-starter")
compileOnly("org.springframework.boot:spring-boot-starter-actuator")
compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth")
compileOnly("org.springframework.cloud:spring-cloud-starter-consul-discovery")
compileOnly("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
compileOnly("io.zipkin.brave:brave-instrumentation-grpc:${braveInstrumentationGrpc}")
compileOnly("javax.inject:javax.inject:1")
compile("io.grpc:grpc-netty:${grpcVersion}")
Expand Down
10 changes: 5 additions & 5 deletions grpc-common-spring-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ version = "${projectVersion}"
compileJava.dependsOn(processResources)

dependencies {
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor:${springBootVersion}")
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor")

compile("org.springframework.boot:spring-boot-starter:${springBootVersion}")
compileOnly("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
compile("io.grpc:grpc-core:${grpcVersion}")
compile("org.springframework.boot:spring-boot-starter")
compileOnly("org.springframework.boot:spring-boot-starter-actuator")
compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth")

compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth:${springCloudSleuthVersion}")
compile("io.grpc:grpc-core:${grpcVersion}")
compileOnly("io.zipkin.brave:brave-instrumentation-grpc:${braveInstrumentationGrpc}")
}
18 changes: 9 additions & 9 deletions grpc-server-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ version = "${projectVersion}"
compileJava.dependsOn(processResources)

dependencies {
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor:${springBootVersion}")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}")
annotationProcessor("org.springframework.boot:spring-boot-autoconfigure-processor")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")

compile project(':grpc-common-spring-boot')
compile("org.springframework.boot:spring-boot-starter:${springBootVersion}")
compileOnly("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
compileOnly("org.springframework.security:spring-security-core:${springSecurityVersion}")
compileOnly("org.springframework.security:spring-security-web:${springSecurityVersion}")
compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth:${springCloudSleuthVersion}")
compileOnly("org.springframework.cloud:spring-cloud-starter-consul-discovery:${springCloudConsulVersion}")
compileOnly("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:${springCloudEurekaVersion}")
compile("org.springframework.boot:spring-boot-starter")
compileOnly("org.springframework.boot:spring-boot-starter-actuator")
compileOnly("org.springframework.security:spring-security-core")
compileOnly("org.springframework.security:spring-security-web")
compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth")
compileOnly("org.springframework.cloud:spring-cloud-starter-consul-discovery")
compileOnly("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
compileOnly("com.google.inject:guice:4.2.2") // Only needed to avoid some warnings during compilation (for eureka)
compileOnly("io.zipkin.brave:brave-instrumentation-grpc:${braveInstrumentationGrpc}")
compile("io.grpc:grpc-netty:${grpcVersion}")
Expand Down

0 comments on commit 57e0866

Please sign in to comment.