-
Notifications
You must be signed in to change notification settings - Fork 938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Spring Boot 2.3.0 #2720
Upgrade to Spring Boot 2.3.0 #2720
Conversation
dependencies.yml
Outdated
@@ -11,7 +11,9 @@ boms: | |||
- io.netty:netty-bom:4.1.50.Final | |||
- io.zipkin.brave:brave-bom:5.11.2 | |||
- org.eclipse.jetty:jetty-bom:9.4.28.v20200408 | |||
- org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Spring Boot 2.3.0, the dependency libraries info included in spring-boot has been changed.
spring-boot doesn't have dependency libraries and version.
I guess we need to refer to spring-boot-dependencies.
2.2.7:
- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot/2.2.7.RELEASE
- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/2.2.7.RELEASE
- https://github.com/spring-projects/spring-boot/blob/v2.2.7.RELEASE/spring-boot-project/spring-boot-dependencies/pom.xml
2.3.0:
- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot/2.3.0.RELEASE
- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/2.3.0.RELEASE
- https://github.com/spring-projects/spring-boot/blob/v2.3.0.RELEASE/spring-boot-project/spring-boot-dependencies/build.gradle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding spring-boot-dependencies
is not a good idea. There are so many version conflicts with other modules such as dropwizard. Actually that's the reason we didn't use Spring BOM before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the solution is I think we need to add the needed dependencies one by one.
implementation "org.jctools:jctools-core:${managedVersions['org.jctools:jctools-core']}" | ||
implementation "org.reflections:reflections:${managedVersions['org.reflections:reflections']}" | ||
implementation "org.bouncycastle:bcprov-jdk15on:${managedVersions['org.bouncycastle:bcprov-jdk15on']}" | ||
implementation "javax.inject:javax.inject:${managedVersions['javax.inject:javax.inject']}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I don't add these settings, can't compile due to the following error.
Seems If I add dependency-management-plugin
, these settings are not applied.
https://github.com/line/armeria/blob/master/build.gradle#L73-L132
$ ./gradlew :examples:spring-boot-minimal:build
> Task :examples:spring-boot-minimal:bootJar FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':examples:spring-boot-minimal:bootJar'.
> Could not resolve all files for configuration ':examples:spring-boot-minimal:productionRuntimeClasspath'.
> Could not find com.spotify:completable-futures:.
Required by:
project :examples:spring-boot-minimal
project :examples:spring-boot-minimal > project :core
project :examples:spring-boot-minimal > project :spring:boot-starter
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter > project :spring:boot-actuator-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure > project :logback
> Could not find it.unimi.dsi:fastutil:.
Required by:
project :examples:spring-boot-minimal
project :examples:spring-boot-minimal > project :core
project :examples:spring-boot-minimal > project :spring:boot-starter
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter > project :spring:boot-actuator-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure > project :logback
> Could not find com.google.guava:guava:.
Required by:
project :examples:spring-boot-minimal
project :examples:spring-boot-minimal > project :core
project :examples:spring-boot-minimal > project :spring:boot-starter
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter > project :spring:boot-actuator-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure > project :logback
> Could not find com.google.code.findbugs:jsr305:.
Required by:
project :examples:spring-boot-minimal
project :examples:spring-boot-minimal > project :core
project :examples:spring-boot-minimal > project :spring:boot-starter
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter > project :spring:boot-actuator-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure > project :logback
> Could not find org.jctools:jctools-core:.
Required by:
project :examples:spring-boot-minimal
project :examples:spring-boot-minimal > project :core
project :examples:spring-boot-minimal > project :spring:boot-starter
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter > project :spring:boot-actuator-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure > project :logback
> Could not find org.reflections:reflections:.
Required by:
project :examples:spring-boot-minimal
project :examples:spring-boot-minimal > project :core
project :examples:spring-boot-minimal > project :spring:boot-starter
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter > project :spring:boot-actuator-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure > project :logback
> Could not find org.bouncycastle:bcprov-jdk15on:.
Required by:
project :examples:spring-boot-minimal > project :core
> Could not find javax.inject:javax.inject:.
Required by:
project :examples:spring-boot-minimal > project :spring:boot-starter > project :spring:boot-autoconfigure
project :examples:spring-boot-minimal > project :spring:boot-actuator-starter > project :spring:boot-actuator-autoconfigure
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
49 actionable tasks: 4 executed, 45 up-to-date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from Boot 2.3.0 productionRuntimeClasspath
is newly added and its canBeConsumed
is true
, so the version is not added because this condition is not meet. https://github.com/line/gradle-scripts/blob/master/lib/common-dependencies.gradle#L156
Perhaps we can add a logic in https://github.com/line/gradle-scripts to set
configurations.productionRuntimeClasspath.setCanBeConsumed(false)
if bootJar
task exists.
@anuraaga Do you have any idea about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, this is how I managed to build this:
diff --git a/dependencies.yml b/dependencies.yml
index ef594b06c..1e216a11f 100644
--- a/dependencies.yml
+++ b/dependencies.yml
@@ -494,12 +494,16 @@ org.slf4j:
- https://static.javadoc.io/org.slf4j/slf4j-api/1.7.30/
slf4j-simple: { version: *SLF4J_VERSION }
+org.springframework:
+ spring-web: { version: '5.2.6.RELEASE' }
+
org.springframework.boot:
spring-boot-starter:
- version: &SPRING_BOOT_VERSION '2.2.7.RELEASE'
+ version: &SPRING_BOOT_VERSION '2.3.0.RELEASE'
javadocs:
- https://docs.spring.io/spring/docs/current/javadoc-api/
spring-boot-actuator-autoconfigure: { version: *SPRING_BOOT_VERSION }
+ spring-boot-autoconfigure: { version: *SPRING_BOOT_VERSION }
spring-boot-starter-actuator: { version: *SPRING_BOOT_VERSION }
spring-boot-starter-test: { version: *SPRING_BOOT_VERSION }
spring-boot-starter-web: { version: *SPRING_BOOT_VERSION }
diff --git a/examples/spring-boot-minimal-kotlin/build.gradle.kts b/examples/spring-boot-minimal-kotlin/build.gradle.kts
index 59dd1b093..581f4014d 100644
--- a/examples/spring-boot-minimal-kotlin/build.gradle.kts
+++ b/examples/spring-boot-minimal-kotlin/build.gradle.kts
@@ -23,6 +23,9 @@ apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "org.springframework.boot")
+val productionRuntimeClasspath by configurations
+productionRuntimeClasspath.setCanBeConsumed(false)
+
dependencies {
implementation(project(":spring:boot-starter"))
implementation("org.hibernate.validator:hibernate-validator")
diff --git a/examples/spring-boot-minimal/build.gradle b/examples/spring-boot-minimal/build.gradle
index bcf6a5621..4874c0019 100644
--- a/examples/spring-boot-minimal/build.gradle
+++ b/examples/spring-boot-minimal/build.gradle
@@ -13,6 +13,8 @@ springBoot {
mainClassName = 'example.springframework.boot.minimal.Main'
}
+configurations.productionRuntimeClasspath.setCanBeConsumed(false)
+
dependencies {
implementation project(':spring:boot-starter')
implementation 'org.hibernate.validator:hibernate-validator'
diff --git a/examples/spring-boot-tomcat/build.gradle b/examples/spring-boot-tomcat/build.gradle
index 58e678673..848ff7de2 100644
--- a/examples/spring-boot-tomcat/build.gradle
+++ b/examples/spring-boot-tomcat/build.gradle
@@ -13,6 +13,8 @@ springBoot {
mainClassName = 'example.springframework.boot.tomcat.Main'
}
+configurations.productionRuntimeClasspath.setCanBeConsumed(false)
+
dependencies {
implementation project(':core')
implementation project(':spring:boot-starter')
diff --git a/examples/spring-boot-webflux/build.gradle b/examples/spring-boot-webflux/build.gradle
index bf2e04e6c..151773407 100644
--- a/examples/spring-boot-webflux/build.gradle
+++ b/examples/spring-boot-webflux/build.gradle
@@ -13,6 +13,8 @@ springBoot {
mainClassName = 'example.springframework.boot.webflux.Main'
}
+configurations.productionRuntimeClasspath.setCanBeConsumed(false)
+
dependencies {
implementation project(':spring:boot-webflux-starter')
diff --git a/it/spring/boot-tomcat/build.gradle b/it/spring/boot-tomcat/build.gradle
index 0aa813e30..e4f60230b 100644
--- a/it/spring/boot-tomcat/build.gradle
+++ b/it/spring/boot-tomcat/build.gradle
@@ -4,5 +4,6 @@ dependencies {
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
+ implementation 'org.springframework:spring-web'
testImplementation('org.springframework.boot:spring-boot-starter-test')
}
diff --git a/it/spring/boot-tomcat8.5/build.gradle b/it/spring/boot-tomcat8.5/build.gradle
index 0d549447e..b89b07700 100644
--- a/it/spring/boot-tomcat8.5/build.gradle
+++ b/it/spring/boot-tomcat8.5/build.gradle
@@ -1,21 +1,28 @@
final def SPRING_BOOT_VERSION = '2.1.14.RELEASE'
+final def SPRING_VERSION = '5.1.15.RELEASE'
final def TOMCAT_VERSION = '8.5.55'
dependencies {
implementation project(':spring:boot-starter')
implementation project(':tomcat8.5')
- implementation("org.springframework.boot:spring-boot-starter") {
- version {
- // Will fail the build if the override doesn't work
- strictly SPRING_BOOT_VERSION
+
+ [ 'spring-boot-starter', 'spring-boot-autoconfigure', 'spring-boot-starter-web' ].each {
+ implementation("org.springframework.boot:$it") {
+ version {
+ // Will fail the build if the override doesn't work
+ strictly SPRING_BOOT_VERSION
+ }
+ exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
}
- implementation("org.springframework.boot:spring-boot-starter-web") {
- version {
- // Will fail the build if the override doesn't work
- strictly SPRING_BOOT_VERSION
+
+ [ 'spring-beans', 'spring-web' ].each {
+ implementation("org.springframework:$it") {
+ version {
+ // Will fail the build if the override doesn't work
+ strictly SPRING_VERSION
+ }
}
- exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
[ 'tomcat-embed-core', 'tomcat-embed-jasper', 'tomcat-embed-el' ].each {
diff --git a/spring/boot-actuator-autoconfigure/build.gradle b/spring/boot-actuator-autoconfigure/build.gradle
index 93c2aedc4..22fbd7fab 100644
--- a/spring/boot-actuator-autoconfigure/build.gradle
+++ b/spring/boot-actuator-autoconfigure/build.gradle
@@ -3,6 +3,8 @@ dependencies {
api 'javax.inject:javax.inject'
compileOnly 'javax.validation:validation-api'
+ implementation 'org.springframework.boot:spring-boot-autoconfigure'
+
testImplementation 'org.springframework.boot:spring-boot-starter-actuator'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
diff --git a/spring/boot-autoconfigure/build.gradle b/spring/boot-autoconfigure/build.gradle
index 3ae48457c..71d2b77d4 100644
--- a/spring/boot-autoconfigure/build.gradle
+++ b/spring/boot-autoconfigure/build.gradle
@@ -3,6 +3,8 @@ dependencies {
compileOnly project(':thrift')
implementation project(':logback')
+ implementation 'org.springframework.boot:spring-boot-autoconfigure'
+
// TODO(anuraaga): Consider removing these since this module does not have related functionality.
optionalApi 'io.micrometer:micrometer-registry-prometheus'
optionalApi 'io.dropwizard.metrics:metrics-json'
Instead of adding the plugin can add a platform dependency on spring boot dependencies like here I guess it's nicer since uses modern Gradle features |
Thank you for the info. I'm still investigating. |
Hmm, that's interesting. Does Spring Boot Gradle plugin override our common dependencies? |
@matsumana Could you merge master branch to fix the failed test?
|
merged master branch. |
I'm still investigating but I realized this issue is occurring in
|
Codecov Report
@@ Coverage Diff @@
## master #2720 +/- ##
============================================
+ Coverage 72.62% 72.63% +0.01%
- Complexity 11631 11637 +6
============================================
Files 1025 1026 +1
Lines 45605 45636 +31
Branches 5683 5688 +5
============================================
+ Hits 33119 33148 +29
- Misses 9566 9568 +2
Partials 2920 2920 Continue to review full report at Codecov.
|
Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @matsumana!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! @matsumana and @minwoox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, folks! @matsumana, could you send a pull request to line/gradle-scripts
before I merge this?
Sure, created. |
This PR adds support for Spring Boot 2.3. See: line/armeria#2720
Thank you! |
Upgrade to Spring Boot 2.3.0
Still work in progress.
depends on #2716.