Skip to content

Commit

Permalink
Only use spring-boot-starter-parent dependency management on Non-exam…
Browse files Browse the repository at this point in the history
…ple project
  • Loading branch information
yidongnan committed Jan 4, 2019
1 parent f7c3892 commit 1ad3378
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
45 changes: 26 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ buildscript {
nettyTCNativeVersion = '2.0.17.Final' // Needs to be compatbile with the 'grpcVersion'

springBootVersion = '2.0.7.RELEASE'
springCloudVersion = 'Finchley.SR2'
springCloudVersion = 'Finchley.SR2' // Only used in examples
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 @@ -140,30 +143,34 @@ allprojects {
maven { url 'http://repo.spring.io/plugins-release' }
maven { url "https://plugins.gradle.org/m2/" }
}
}
}

dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
allprojects { project ->
if (!project.parent || project.parent.name != "examples") {
buildscript {
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
}
}
}

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

tasks.withType(Javadoc) {
def links = [
'https://docs.oracle.com/javase/8/docs/api/',
'https://grpc.io/grpc-java/javadoc/',
'https://docs.spring.io/spring-framework/docs/' + springFrameworkVersion + '/javadoc-api/',
'https://docs.spring.io/spring-security/site/docs/' + springSecurityVersion + '/api/'
];
options.setLinks(links)
tasks.withType(Javadoc) {
def links = [
'https://docs.oracle.com/javase/8/docs/api/',
'https://grpc.io/grpc-java/javadoc/',
'https://docs.spring.io/spring-framework/docs/' + springFrameworkVersion + '/javadoc-api/',
'https://docs.spring.io/spring-security/site/docs/' + springSecurityVersion + '/api/'
]
options.setLinks(links)
}
}

}

apply from: './deploy.gradle'
Expand Down
6 changes: 3 additions & 3 deletions grpc-client-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ dependencies {
compile project(':grpc-common-spring-boot')
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("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}")
compileOnly("io.zipkin.brave:brave-instrumentation-grpc:${braveInstrumentationGrpc}")
compileOnly("javax.inject:javax.inject:1")
compile("io.grpc:grpc-netty:${grpcVersion}")
Expand Down
4 changes: 2 additions & 2 deletions grpc-common-spring-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dependencies {

compile("org.springframework.boot:spring-boot-starter")
compileOnly("org.springframework.boot:spring-boot-starter-actuator")
compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth")

compile("io.grpc:grpc-core:${grpcVersion}")

compileOnly("org.springframework.cloud:spring-cloud-starter-sleuth:${springCloudSleuthVersion}")
compileOnly("io.zipkin.brave:brave-instrumentation-grpc:${braveInstrumentationGrpc}")
}
6 changes: 3 additions & 3 deletions grpc-server-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ dependencies {
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("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}")
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
6 changes: 3 additions & 3 deletions tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ dependencies {
}
testImplementation(
"io.grpc:grpc-testing:${grpcVersion}",
"org.springframework.boot:spring-boot-starter-test:${springBootVersion}",
"org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}",
"org.springframework.security:spring-security-config:${springSecurityVersion}",
"org.springframework.boot:spring-boot-starter-test",
"org.springframework.boot:spring-boot-starter-actuator",
"org.springframework.security:spring-security-config",
"io.netty:netty-tcnative-boringssl-static:${nettyTCNativeVersion}",
"org.junit.jupiter:junit-jupiter-api:${jUnitVersion}"
)
Expand Down

3 comments on commit 1ad3378

@ST-DDT
Copy link
Collaborator

@ST-DDT ST-DDT commented on 1ad3378 Jan 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this? Is there a conflict with the imported bom? Or do we need more flexibility?
Would adding the bom to only the examples fix it?

@yidongnan
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>net.devh</groupId>
  <artifactId>grpc-server-spring-boot-autoconfigure</artifactId>
  <version>2.2.0.RELEASE</version>
  <name>gRPC Spring Boot Starter</name>
  
    ...

  <dependencies>
    <dependency>
      <groupId>net.devh</groupId>
      <artifactId>grpc-common-spring-boot</artifactId>
      <version>2.2.0.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-netty</artifactId>
      <version>1.17.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-protobuf</artifactId>
      <version>1.17.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-stub</artifactId>
      <version>1.17.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-services</artifactId>
      <version>1.17.1</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
  <dependencyManagement>
    <dependencies>

      <!-- We don't need this -->
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>Finchley.SR2</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.7.RELEASE</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

I think publish dependency does not require spring-cloud-dependencies dependency management, and the spring-cloud-dependencies includes the spring-boot-starter-parent.

@ST-DDT
Copy link
Collaborator

@ST-DDT ST-DDT commented on 1ad3378 Jan 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I didn't notice this issue.

Please sign in to comment.