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 <chris.bono@gmail.com>
This commit is contained in:
Chris Bono
2025-03-07 09:33:52 -06:00
committed by Dave Syer
parent d8995bb59a
commit 454f0b832d
8 changed files with 237 additions and 56 deletions

View File

@@ -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 applications build script avoids the need for you to specify and maintain the dependency versions yourself.
Instead, the version youre 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 youre 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 youre a Maven user, you can use the dependencies by adding the following to your pom.xml file -
```xml
@@ -201,7 +209,7 @@ If youre a Maven user, you can use the dependencies by adding the following t
</dependencyManagement>
```
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.

View File

@@ -14,8 +14,6 @@
<description>Building gRPC applications with Spring Boot</description>
<modules>
<module>spring-grpc-docs</module>
<module>spring-grpc-dependencies</module>
<module>spring-grpc-core</module>
<module>spring-grpc-test</module>
<module>spring-grpc-spring-boot-autoconfigure</module>
@@ -23,6 +21,9 @@
<module>spring-grpc-client-spring-boot-starter</module>
<module>spring-grpc-server-spring-boot-starter</module>
<module>spring-grpc-server-web-spring-boot-starter</module>
<module>spring-grpc-dependencies</module>
<module>spring-grpc-build-dependencies</module>
<module>spring-grpc-docs</module>
<module>samples</module>
</modules>
@@ -486,7 +487,7 @@
<dependencies>
<dependency>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-dependencies</artifactId>
<artifactId>spring-grpc-build-dependencies</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>

View File

@@ -186,4 +186,4 @@
</pluginRepositories>
</project>
</project>

View File

@@ -210,4 +210,4 @@
</pluginRepositories>
</project>
</project>

View File

@@ -136,4 +136,4 @@
</plugins>
</build>
</project>
</project>

View File

@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-build-dependencies</artifactId>
<version>0.4.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring gRPC build dependencies</name>
<description>Dependencies for the Spring gRPC modules</description>
<url>https://github.com/spring-projects-experimental/spring-grpc</url>
<scm>
<url>https://github.com/spring-projects-experimental/spring-grpc</url>
<connection>git://github.com/spring-projects-experimental/spring-grpc.git</connection>
<developerConnection>git@github.com:spring-projects-experimental/spring-grpc.git</developerConnection>
</scm>
<distributionManagement>
<downloadUrl>https://github.com/spring-projects-experimental/spring-grpc</downloadUrl>
<site>
<id>spring-docs</id>
<url>scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-grpc/docs/${project.artifactId}/${project.version}</url>
</site>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>repo.spring.io</id>
<url>https://repo.spring.io/libs-snapshot-local</url>
<releases>
<enabled>false</enabled>
</releases>
</snapshotRepository>
</distributionManagement>
<licenses>
<license>
<name>Apache 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<spring-framework.version>6.2.3</spring-framework.version>
<spring-security.version>6.4.2</spring-security.version>
<micrometer.version>1.13.6</micrometer.version>
<netty.version>4.1.118.Final</netty.version>
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-dependencies</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring-framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>${spring-security.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
<version>${spring-javaformat-maven-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
<configuration>
<skip>true</skip>
</configuration>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>staging</id>
<distributionManagement>
<repository>
<id>repo.spring.io</id>
<url>https://repo.spring.io/libs-staging-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</distributionManagement>
</profile>
<profile>
<id>milestone</id>
<distributionManagement>
<repository>
<id>repo.spring.io</id>
<url>https://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</distributionManagement>
</profile>
<profile>
<id>central</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<arg>--batch</arg>
<arg>--pinentry-mode=loopback</arg>
</gpgArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<developers>
<developer>
<id>dsyer</id>
<name>Dave Syer</name>
<email>david.syer at broadcom.com</email>
<organization>Broadcom</organization>
<organizationUrl>http://www.spring.io</organizationUrl>
<roles>
<role>lead</role>
</roles>
</developer>
</developers>
</project>

View File

@@ -9,8 +9,8 @@
<version>0.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring gRPC dependencies</name>
<description>Dependencies for the Spring gRPC modules</description>
<name>Spring gRPC (Bill of Materials)</name>
<description>Bill of Materials for the Spring gRPC modules</description>
<url>https://github.com/spring-projects-experimental/spring-grpc</url>
@@ -49,14 +49,12 @@
</licenses>
<properties>
<spring-framework.version>6.2.3</spring-framework.version>
<spring-security.version>6.4.2</spring-security.version>
<netty.version>4.1.118.Final</netty.version>
<grpc.version>1.70.0</grpc.version>
<protobuf-java.version>3.25.6</protobuf-java.version>
<google-common-protos.version>2.46.0</google-common-protos.version>
<micrometer.version>1.13.6</micrometer.version>
<reactor-grpc.version>1.2.4</reactor-grpc.version>
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
</properties>
<dependencyManagement>
@@ -91,30 +89,15 @@
<artifactId>spring-grpc-server-web-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Utilities -->
<dependency>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-test</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring-framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>${spring-security.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
<version>${grpc.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -130,33 +113,35 @@
<artifactId>protoc</artifactId>
<version>${protobuf-java.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
<version>${grpc.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>${google-common-protos.version}</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-bom</artifactId>
<version>${micrometer.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.salesforce.servicelibs</groupId>
<artifactId>reactor-grpc-stub</artifactId>
<version>${reactor-grpc.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
<version>${spring-javaformat-maven-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
<configuration>
<skip>true</skip>
</configuration>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>staging</id>

View File

@@ -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 applications build script avoids the need for you to specify and maintain the dependency versions yourself.
Instead, the version youre 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 youre 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 youre a Maven user, you can use the dependencies by adding the following to your pom.xml file -
[source,xml]
@@ -207,7 +214,7 @@ If youre a Maven user, you can use the dependencies by adding the following t
</dependencyManagement>
----
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.