From 454f0b832d05481d1c29fee22e5ad02ad0eaddd5 Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Fri, 7 Mar 2025 09:33:52 -0600 Subject: [PATCH] Extract Boot managed deps. from spring-grpc-dependencies This extracts the Spring Boot managed dependencies from the spring-grpc-dependencies BOM module into a new module (`spring-grpc-build-dependencies`) that includes the dependencies from the BOM as well as the Spring Boot managed dependencies. Resolves #118 Signed-off-by: Chris Bono --- README.md | 16 +- pom.xml | 7 +- samples/grpc-oauth2/pom.xml | 2 +- samples/grpc-reactive/pom.xml | 2 +- samples/grpc-server-netty-shaded/pom.xml | 2 +- spring-grpc-build-dependencies/pom.xml | 180 ++++++++++++++++++ spring-grpc-dependencies/pom.xml | 69 +++---- .../modules/ROOT/pages/getting-started.adoc | 15 +- 8 files changed, 237 insertions(+), 56 deletions(-) create mode 100644 spring-grpc-build-dependencies/pom.xml diff --git a/README.md b/README.md index 46ee6fc..3d9a3be 100644 --- a/README.md +++ b/README.md @@ -180,11 +180,19 @@ repositories { ### Dependency Management -The Spring gRPC Dependencies declares the recommended versions of all the dependencies used by a given release of Spring gRPC. -Using the dependencies from your application’s build script avoids the need for you to specify and maintain the dependency versions yourself. -Instead, the version you’re using determines the utilized dependency versions. +The `spring-grpc-dependencies` artifact declares the recommended versions of the dependencies used by a given release of Spring gRPC, excluding dependencies already managed by Spring Boot dependency management. + +The `spring-grpc-build-dependencies` artifact declares the recommended versions of all the dependencies used by a given release of Spring gRPC, including dependencies already managed by Spring Boot dependency management. + +If you are running Spring gRPC in a Spring Boot application then use `spring-grpc-dependencies`, otherwise use `spring-grpc-build-dependencies`. + +Using one of these dependency modules avoids the need for you to specify and maintain the dependency versions yourself. +Instead, the version of the dependency module you are using determines the utilized dependency versions. It also ensures that you’re using supported and tested versions of the dependencies by default, unless you choose to override them. +**📌 NOTE**\ +The examples below assume you are running inside a Spring Boot application and therefore use `spring-grpc-dependencies`. + If you’re a Maven user, you can use the dependencies by adding the following to your pom.xml file - ```xml @@ -201,7 +209,7 @@ If you’re a Maven user, you can use the dependencies by adding the following t ``` -Gradle users can also use the Spring gRPC Dependencies by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM. +Gradle users can also use the dependencies by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM. This is implemented by adding a 'platform' dependency handler method to the dependencies section of your Gradle build script. As shown in the snippet below this can then be followed by version-less declarations of the Starter Dependencies for the one or more spring-grpc modules you wish to use, e.g. spring-grpc-openai. diff --git a/pom.xml b/pom.xml index 5aea227..f39a1bf 100644 --- a/pom.xml +++ b/pom.xml @@ -14,8 +14,6 @@ Building gRPC applications with Spring Boot - spring-grpc-docs - spring-grpc-dependencies spring-grpc-core spring-grpc-test spring-grpc-spring-boot-autoconfigure @@ -23,6 +21,9 @@ spring-grpc-client-spring-boot-starter spring-grpc-server-spring-boot-starter spring-grpc-server-web-spring-boot-starter + spring-grpc-dependencies + spring-grpc-build-dependencies + spring-grpc-docs samples @@ -486,7 +487,7 @@ org.springframework.grpc - spring-grpc-dependencies + spring-grpc-build-dependencies ${project.version} pom import diff --git a/samples/grpc-oauth2/pom.xml b/samples/grpc-oauth2/pom.xml index ccfbca8..3209cc5 100644 --- a/samples/grpc-oauth2/pom.xml +++ b/samples/grpc-oauth2/pom.xml @@ -186,4 +186,4 @@ - \ No newline at end of file + diff --git a/samples/grpc-reactive/pom.xml b/samples/grpc-reactive/pom.xml index dda236a..39d16fe 100644 --- a/samples/grpc-reactive/pom.xml +++ b/samples/grpc-reactive/pom.xml @@ -210,4 +210,4 @@ - \ No newline at end of file + diff --git a/samples/grpc-server-netty-shaded/pom.xml b/samples/grpc-server-netty-shaded/pom.xml index 706cb1d..e22193a 100644 --- a/samples/grpc-server-netty-shaded/pom.xml +++ b/samples/grpc-server-netty-shaded/pom.xml @@ -136,4 +136,4 @@ - \ No newline at end of file + diff --git a/spring-grpc-build-dependencies/pom.xml b/spring-grpc-build-dependencies/pom.xml new file mode 100644 index 0000000..352e3c2 --- /dev/null +++ b/spring-grpc-build-dependencies/pom.xml @@ -0,0 +1,180 @@ + + + 4.0.0 + + org.springframework.grpc + spring-grpc-build-dependencies + 0.4.0-SNAPSHOT + pom + + Spring gRPC build dependencies + Dependencies for the Spring gRPC modules + + https://github.com/spring-projects-experimental/spring-grpc + + + https://github.com/spring-projects-experimental/spring-grpc + git://github.com/spring-projects-experimental/spring-grpc.git + git@github.com:spring-projects-experimental/spring-grpc.git + + + + https://github.com/spring-projects-experimental/spring-grpc + + spring-docs + scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-grpc/docs/${project.artifactId}/${project.version} + + + sonatype-nexus-staging + Nexus Release Repository + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + repo.spring.io + https://repo.spring.io/libs-snapshot-local + + false + + + + + + + Apache 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + 6.2.3 + 6.4.2 + 1.13.6 + 4.1.118.Final + 0.0.43 + + + + + + org.springframework.grpc + spring-grpc-dependencies + ${project.version} + pom + import + + + org.springframework + spring-framework-bom + ${spring-framework.version} + pom + import + + + org.springframework.security + spring-security-bom + ${spring-security.version} + pom + import + + + io.netty + netty-bom + ${netty.version} + pom + import + + + + + + + + io.spring.javaformat + spring-javaformat-maven-plugin + ${spring-javaformat-maven-plugin.version} + + + validate + + true + + + validate + + + + + + + + + + staging + + + repo.spring.io + https://repo.spring.io/libs-staging-local + + false + + + + + + milestone + + + repo.spring.io + https://repo.spring.io/libs-milestone-local + + false + + + + + + central + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + --batch + --pinentry-mode=loopback + + + + + + + + + + + dsyer + Dave Syer + david.syer at broadcom.com + Broadcom + http://www.spring.io + + lead + + + + + diff --git a/spring-grpc-dependencies/pom.xml b/spring-grpc-dependencies/pom.xml index 8b2516d..ef607d3 100644 --- a/spring-grpc-dependencies/pom.xml +++ b/spring-grpc-dependencies/pom.xml @@ -9,8 +9,8 @@ 0.5.0-SNAPSHOT pom - Spring gRPC dependencies - Dependencies for the Spring gRPC modules + Spring gRPC (Bill of Materials) + Bill of Materials for the Spring gRPC modules https://github.com/spring-projects-experimental/spring-grpc @@ -49,14 +49,12 @@ - 6.2.3 - 6.4.2 - 4.1.118.Final 1.70.0 3.25.6 2.46.0 1.13.6 1.2.4 + 0.0.43 @@ -91,30 +89,15 @@ spring-grpc-server-web-spring-boot-starter ${project.version} - org.springframework.grpc spring-grpc-test ${project.version} - org.springframework - spring-framework-bom - ${spring-framework.version} - pom - import - - - org.springframework.security - spring-security-bom - ${spring-security.version} - pom - import - - - io.netty - netty-bom - ${netty.version} + io.grpc + grpc-bom + ${grpc.version} pom import @@ -130,33 +113,35 @@ protoc ${protobuf-java.version} - - io.grpc - grpc-bom - ${grpc.version} - pom - import - com.google.api.grpc proto-google-common-protos ${google-common-protos.version} - - io.micrometer - micrometer-bom - ${micrometer.version} - pom - import - - - com.salesforce.servicelibs - reactor-grpc-stub - ${reactor-grpc.version} - + + + + io.spring.javaformat + spring-javaformat-maven-plugin + ${spring-javaformat-maven-plugin.version} + + + validate + + true + + + validate + + + + + + + staging diff --git a/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc b/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc index 50fd71b..d57fb35 100644 --- a/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc +++ b/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc @@ -185,11 +185,18 @@ repositories { [[dependency-management]] === Dependency Management -The Spring gRPC Dependencies declares the recommended versions of all the dependencies used by a given release of Spring gRPC. -Using the dependencies from your application’s build script avoids the need for you to specify and maintain the dependency versions yourself. -Instead, the version you’re using determines the utilized dependency versions. +The `spring-grpc-dependencies` artifact declares the recommended versions of the dependencies used by a given release of Spring gRPC, excluding dependencies already managed by Spring Boot dependency management. + +The `spring-grpc-build-dependencies` artifact declares the recommended versions of all the dependencies used by a given release of Spring gRPC, including dependencies already managed by Spring Boot dependency management. + +If you are running Spring gRPC in a Spring Boot application then use `spring-grpc-dependencies`, otherwise use `spring-grpc-build-dependencies`. + +Using one of these dependency modules avoids the need for you to specify and maintain the dependency versions yourself. +Instead, the version of the dependency module you are using determines the utilized dependency versions. It also ensures that you’re using supported and tested versions of the dependencies by default, unless you choose to override them. +NOTE: The examples below assume you are running inside a Spring Boot application and therefore use `spring-grpc-dependencies`. + If you’re a Maven user, you can use the dependencies by adding the following to your pom.xml file - [source,xml] @@ -207,7 +214,7 @@ If you’re a Maven user, you can use the dependencies by adding the following t ---- -Gradle users can also use the Spring gRPC Dependencies by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM. +Gradle users can also use the dependencies by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM. This is implemented by adding a 'platform' dependency handler method to the dependencies section of your Gradle build script. As shown in the snippet below this can then be followed by version-less declarations of the Starter Dependencies for the one or more spring-grpc modules you wish to use, e.g. spring-grpc-openai.