From 28de9b7b8b45130d6309328e3d2cdf5c62abe19b Mon Sep 17 00:00:00 2001 From: Jay Bryant Date: Wed, 6 Dec 2023 12:29:06 -0600 Subject: [PATCH] Update to Spring Boot 3.2.0 And update the readmen file and /complete build files to use includes. --- Jenkinsfile | 44 -------------- README.adoc | 19 +----- complete/build.gradle | 58 +++++++++--------- complete/pom.xml | 135 +++++++++++++++++++++++------------------- initial/build.gradle | 55 ++++++++--------- initial/pom.xml | 129 +++++++++++++++++++++------------------- 6 files changed, 198 insertions(+), 242 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index bafafc8..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,44 +0,0 @@ -pipeline { - agent none - - triggers { - pollSCM 'H/10 * * * *' - } - - options { - disableConcurrentBuilds() - buildDiscarder(logRotator(numToKeepStr: '14')) - } - - stages { - stage("test: baseline (jdk8)") { - agent { - docker { - image 'adoptopenjdk/openjdk8:latest' - args '-v $HOME/.m2:/tmp/jenkins-home/.m2' - } - } - options { timeout(time: 30, unit: 'MINUTES') } - steps { - sh 'test/run.sh' - } - } - - } - - post { - changed { - script { - slackSend( - color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger', - channel: '#sagan-content', - message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}") - emailext( - subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}", - mimeType: 'text/html', - recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']], - body: "${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}") - } - } - } -} diff --git a/README.adoc b/README.adoc index 5356677..8df5158 100644 --- a/README.adoc +++ b/README.adoc @@ -1,9 +1,3 @@ -:spring_version: current -:spring_boot_version: 2.5.4 -:Controller: https://docs.spring.io/spring/docs/{spring_version}/javadoc-api/org/springframework/stereotype/Controller.html -:DispatcherServlet: https://docs.spring.io/spring/docs/{spring_version}/javadoc-api/org/springframework/web/servlet/DispatcherServlet.html -:SpringApplication: https://docs.spring.io/spring-boot/docs/{spring_boot_version}/api/org/springframework/boot/SpringApplication.html -:ResponseBody: https://docs.spring.io/spring/docs/{spring_version}/javadoc-api/org/springframework/web/bind/annotation/ResponseBody.html :toc: :icons: font :source-highlighter: prettify @@ -25,7 +19,7 @@ include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/ [[scratch]] == Starting with Spring Initializr -You can use this https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.5.5&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=gateway&name=gateway&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.gateway&dependencies=cloud-gateway,cloud-resilience4j,cloud-contract-stub-runner[pre-initialized project] and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial. +You can use this https://start.spring.io/#!type=maven-project&language=java&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=gateway&name=gateway&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.gateway&dependencies=cloud-gateway,cloud-resilience4j,cloud-contract-stub-runner[pre-initialized project] and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial. To manually initialize the project: @@ -125,20 +119,13 @@ To use this filter you need to add the reactive Resilience4J CircuitBreaker depe `pom.xml` [source,java,tabsize=2] ---- -... - - org.springframework.cloud - spring-cloud-starter-circuitbreaker-reactor-resilience4j - -... +include::complete/pom.xml[tags=dependency] ---- `build.gradle` [source,java,tabsize=2] ---- -... -implementation("org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j") -... +include::complete/build.gradle[tags=dependency] ---- In the next example, we use HTTPBin's delay API, which waits a certain number of diff --git a/complete/build.gradle b/complete/build.gradle index ff8e7e3..0096c38 100644 --- a/complete/build.gradle +++ b/complete/build.gradle @@ -1,41 +1,41 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.7.1") - } +plugins { + id 'java' + id 'org.springframework.boot' version '3.2.0' + id 'io.spring.dependency-management' version '1.1.4' } -apply plugin: 'java' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' +group = 'com.example' +version = '0.0.1-SNAPSHOT' -bootJar { - baseName = 'gs-gateway' - version = '0.1.0' +java { + sourceCompatibility = '17' } repositories { - mavenCentral() + mavenCentral() + maven { url 'https://repo.spring.io/milestone' } } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.3" - } +ext { + set('springCloudVersion', "2023.0.0-RC1") } dependencies { - implementation("org.springframework.cloud:spring-cloud-starter-gateway") - implementation("org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j") - implementation("org.springframework.cloud:spring-cloud-starter-contract-stub-runner"){ - exclude group: "org.springframework.boot", module: "spring-boot-starter-web" - } - testImplementation("org.springframework.boot:spring-boot-starter-test") + implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j' + // tag::dependency[] + implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j' + // end::dependency[] + implementation 'org.springframework.cloud:spring-cloud-starter-gateway' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner' +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" + } } + +tasks.named('test') { + useJUnitPlatform() +} \ No newline at end of file diff --git a/complete/pom.xml b/complete/pom.xml index 0793237..07be9b2 100644 --- a/complete/pom.xml +++ b/complete/pom.xml @@ -1,67 +1,78 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.0 + + + com.example + gs-gateway + 0.0.1-SNAPSHOT + gs-gateway + Demo project for Spring Boot + + 17 + 2023.0.0-RC1 + + + + org.springframework.cloud + spring-cloud-starter-circuitbreaker-resilience4j + + + + org.springframework.cloud + spring-cloud-starter-circuitbreaker-reactor-resilience4j + + + + org.springframework.cloud + spring-cloud-starter-gateway + - org.springframework - gs-gateway - 0.1.0 + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.cloud + spring-cloud-starter-contract-stub-runner + test + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + - - org.springframework.boot - spring-boot-starter-parent - 2.7.1 - + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + - - - - org.springframework.cloud - spring-cloud-dependencies - 2021.0.3 - pom - import - - - - - - - org.springframework.cloud - spring-cloud-starter-gateway - - - org.springframework.cloud - spring-cloud-starter-circuitbreaker-reactor-resilience4j - - - org.springframework.cloud - spring-cloud-starter-contract-stub-runner - - - spring-boot-starter-web - org.springframework.boot - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - 1.8 - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - + \ No newline at end of file diff --git a/initial/build.gradle b/initial/build.gradle index ff8e7e3..8aa45d4 100644 --- a/initial/build.gradle +++ b/initial/build.gradle @@ -1,41 +1,38 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.7.1") - } +plugins { + id 'java' + id 'org.springframework.boot' version '3.2.0' + id 'io.spring.dependency-management' version '1.1.4' } -apply plugin: 'java' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' +group = 'com.example' +version = '0.0.1-SNAPSHOT' -bootJar { - baseName = 'gs-gateway' - version = '0.1.0' +java { + sourceCompatibility = '17' } repositories { - mavenCentral() + mavenCentral() + maven { url 'https://repo.spring.io/milestone' } } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencyManagement { - imports { - mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.3" - } +ext { + set('springCloudVersion', "2023.0.0-RC1") } dependencies { - implementation("org.springframework.cloud:spring-cloud-starter-gateway") - implementation("org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j") - implementation("org.springframework.cloud:spring-cloud-starter-contract-stub-runner"){ - exclude group: "org.springframework.boot", module: "spring-boot-starter-web" - } - testImplementation("org.springframework.boot:spring-boot-starter-test") + implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j' + implementation 'org.springframework.cloud:spring-cloud-starter-gateway' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner' +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" + } } + +tasks.named('test') { + useJUnitPlatform() +} \ No newline at end of file diff --git a/initial/pom.xml b/initial/pom.xml index 888ce62..52c0569 100644 --- a/initial/pom.xml +++ b/initial/pom.xml @@ -1,67 +1,72 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.0 + + + com.example + gs-gateway + 0.0.1-SNAPSHOT + gs-gateway + Demo project for Spring Boot + + 17 + 2023.0.0-RC1 + + + + org.springframework.cloud + spring-cloud-starter-circuitbreaker-resilience4j + + + org.springframework.cloud + spring-cloud-starter-gateway + - org.springframework - gs-gateway - 0.1.0 + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.cloud + spring-cloud-starter-contract-stub-runner + test + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + - - org.springframework.boot - spring-boot-starter-parent - 2.7.1 - + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + - - - - org.springframework.cloud - spring-cloud-dependencies - 2021.0.3 - pom - import - - - - - - - org.springframework.cloud - spring-cloud-starter-gateway - - - org.springframework.cloud - spring-cloud-starter-circuitbreaker-reactor-resilience4j - - - org.springframework.cloud - spring-cloud-starter-contract-stub-runner - - - spring-boot-starter-web - org.springframework.boot - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - 1.8 - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - + \ No newline at end of file