Skip to content

Commit 454f0b8

Browse files
onobcdsyer
authored andcommitted
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 <[email protected]>
1 parent d8995bb commit 454f0b8

File tree

8 files changed

+237
-56
lines changed

8 files changed

+237
-56
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,19 @@ repositories {
180180

181181
### Dependency Management
182182

183-
The Spring gRPC Dependencies declares the recommended versions of all the dependencies used by a given release of Spring gRPC.
184-
Using the dependencies from your application’s build script avoids the need for you to specify and maintain the dependency versions yourself.
185-
Instead, the version you’re using determines the utilized dependency versions.
183+
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.
184+
185+
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.
186+
187+
If you are running Spring gRPC in a Spring Boot application then use `spring-grpc-dependencies`, otherwise use `spring-grpc-build-dependencies`.
188+
189+
Using one of these dependency modules avoids the need for you to specify and maintain the dependency versions yourself.
190+
Instead, the version of the dependency module you are using determines the utilized dependency versions.
186191
It also ensures that you’re using supported and tested versions of the dependencies by default, unless you choose to override them.
187192

193+
**📌 NOTE**\
194+
The examples below assume you are running inside a Spring Boot application and therefore use `spring-grpc-dependencies`.
195+
188196
If you’re a Maven user, you can use the dependencies by adding the following to your pom.xml file -
189197

190198
```xml
@@ -201,7 +209,7 @@ If you’re a Maven user, you can use the dependencies by adding the following t
201209
</dependencyManagement>
202210
```
203211

204-
Gradle users can also use the Spring gRPC Dependencies by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM.
212+
Gradle users can also use the dependencies by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM.
205213
This is implemented by adding a 'platform' dependency handler method to the dependencies section of your Gradle build script.
206214
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.
207215

pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
<description>Building gRPC applications with Spring Boot</description>
1515

1616
<modules>
17-
<module>spring-grpc-docs</module>
18-
<module>spring-grpc-dependencies</module>
1917
<module>spring-grpc-core</module>
2018
<module>spring-grpc-test</module>
2119
<module>spring-grpc-spring-boot-autoconfigure</module>
2220
<module>spring-grpc-spring-boot-starter</module>
2321
<module>spring-grpc-client-spring-boot-starter</module>
2422
<module>spring-grpc-server-spring-boot-starter</module>
2523
<module>spring-grpc-server-web-spring-boot-starter</module>
24+
<module>spring-grpc-dependencies</module>
25+
<module>spring-grpc-build-dependencies</module>
26+
<module>spring-grpc-docs</module>
2627
<module>samples</module>
2728
</modules>
2829

@@ -486,7 +487,7 @@
486487
<dependencies>
487488
<dependency>
488489
<groupId>org.springframework.grpc</groupId>
489-
<artifactId>spring-grpc-dependencies</artifactId>
490+
<artifactId>spring-grpc-build-dependencies</artifactId>
490491
<version>${project.version}</version>
491492
<type>pom</type>
492493
<scope>import</scope>

samples/grpc-oauth2/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,4 @@
186186
</pluginRepositories>
187187

188188

189-
</project>
189+
</project>

samples/grpc-reactive/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,4 @@
210210
</pluginRepositories>
211211

212212

213-
</project>
213+
</project>

samples/grpc-server-netty-shaded/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,4 @@
136136
</plugins>
137137
</build>
138138

139-
</project>
139+
</project>
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.springframework.grpc</groupId>
8+
<artifactId>spring-grpc-build-dependencies</artifactId>
9+
<version>0.4.0-SNAPSHOT</version>
10+
<packaging>pom</packaging>
11+
12+
<name>Spring gRPC build dependencies</name>
13+
<description>Dependencies for the Spring gRPC modules</description>
14+
15+
<url>https://github.com/spring-projects-experimental/spring-grpc</url>
16+
17+
<scm>
18+
<url>https://github.com/spring-projects-experimental/spring-grpc</url>
19+
<connection>git://github.com/spring-projects-experimental/spring-grpc.git</connection>
20+
<developerConnection>[email protected]:spring-projects-experimental/spring-grpc.git</developerConnection>
21+
</scm>
22+
23+
<distributionManagement>
24+
<downloadUrl>https://github.com/spring-projects-experimental/spring-grpc</downloadUrl>
25+
<site>
26+
<id>spring-docs</id>
27+
<url>scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-grpc/docs/${project.artifactId}/${project.version}</url>
28+
</site>
29+
<repository>
30+
<id>sonatype-nexus-staging</id>
31+
<name>Nexus Release Repository</name>
32+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
33+
</repository>
34+
<snapshotRepository>
35+
<id>repo.spring.io</id>
36+
<url>https://repo.spring.io/libs-snapshot-local</url>
37+
<releases>
38+
<enabled>false</enabled>
39+
</releases>
40+
</snapshotRepository>
41+
</distributionManagement>
42+
43+
<licenses>
44+
<license>
45+
<name>Apache 2.0</name>
46+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
47+
<distribution>repo</distribution>
48+
</license>
49+
</licenses>
50+
51+
<properties>
52+
<spring-framework.version>6.2.3</spring-framework.version>
53+
<spring-security.version>6.4.2</spring-security.version>
54+
<micrometer.version>1.13.6</micrometer.version>
55+
<netty.version>4.1.118.Final</netty.version>
56+
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
57+
</properties>
58+
59+
<dependencyManagement>
60+
<dependencies>
61+
<dependency>
62+
<groupId>org.springframework.grpc</groupId>
63+
<artifactId>spring-grpc-dependencies</artifactId>
64+
<version>${project.version}</version>
65+
<type>pom</type>
66+
<scope>import</scope>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.springframework</groupId>
70+
<artifactId>spring-framework-bom</artifactId>
71+
<version>${spring-framework.version}</version>
72+
<type>pom</type>
73+
<scope>import</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>org.springframework.security</groupId>
77+
<artifactId>spring-security-bom</artifactId>
78+
<version>${spring-security.version}</version>
79+
<type>pom</type>
80+
<scope>import</scope>
81+
</dependency>
82+
<dependency>
83+
<groupId>io.netty</groupId>
84+
<artifactId>netty-bom</artifactId>
85+
<version>${netty.version}</version>
86+
<type>pom</type>
87+
<scope>import</scope>
88+
</dependency>
89+
</dependencies>
90+
</dependencyManagement>
91+
92+
<build>
93+
<plugins>
94+
<plugin>
95+
<groupId>io.spring.javaformat</groupId>
96+
<artifactId>spring-javaformat-maven-plugin</artifactId>
97+
<version>${spring-javaformat-maven-plugin.version}</version>
98+
<executions>
99+
<execution>
100+
<phase>validate</phase>
101+
<configuration>
102+
<skip>true</skip>
103+
</configuration>
104+
<goals>
105+
<goal>validate</goal>
106+
</goals>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
</plugins>
111+
</build>
112+
113+
<profiles>
114+
<profile>
115+
<id>staging</id>
116+
<distributionManagement>
117+
<repository>
118+
<id>repo.spring.io</id>
119+
<url>https://repo.spring.io/libs-staging-local</url>
120+
<snapshots>
121+
<enabled>false</enabled>
122+
</snapshots>
123+
</repository>
124+
</distributionManagement>
125+
</profile>
126+
<profile>
127+
<id>milestone</id>
128+
<distributionManagement>
129+
<repository>
130+
<id>repo.spring.io</id>
131+
<url>https://repo.spring.io/libs-milestone-local</url>
132+
<snapshots>
133+
<enabled>false</enabled>
134+
</snapshots>
135+
</repository>
136+
</distributionManagement>
137+
</profile>
138+
<profile>
139+
<id>central</id>
140+
<build>
141+
<plugins>
142+
<plugin>
143+
<groupId>org.apache.maven.plugins</groupId>
144+
<artifactId>maven-gpg-plugin</artifactId>
145+
<version>1.6</version>
146+
<executions>
147+
<execution>
148+
<id>sign-artifacts</id>
149+
<phase>verify</phase>
150+
<goals>
151+
<goal>sign</goal>
152+
</goals>
153+
</execution>
154+
</executions>
155+
<configuration>
156+
<gpgArguments>
157+
<arg>--batch</arg>
158+
<arg>--pinentry-mode=loopback</arg>
159+
</gpgArguments>
160+
</configuration>
161+
</plugin>
162+
</plugins>
163+
</build>
164+
</profile>
165+
</profiles>
166+
167+
<developers>
168+
<developer>
169+
<id>dsyer</id>
170+
<name>Dave Syer</name>
171+
<email>david.syer at broadcom.com</email>
172+
<organization>Broadcom</organization>
173+
<organizationUrl>http://www.spring.io</organizationUrl>
174+
<roles>
175+
<role>lead</role>
176+
</roles>
177+
</developer>
178+
</developers>
179+
180+
</project>

spring-grpc-dependencies/pom.xml

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>0.5.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

12-
<name>Spring gRPC dependencies</name>
13-
<description>Dependencies for the Spring gRPC modules</description>
12+
<name>Spring gRPC (Bill of Materials)</name>
13+
<description>Bill of Materials for the Spring gRPC modules</description>
1414

1515
<url>https://github.com/spring-projects-experimental/spring-grpc</url>
1616

@@ -49,14 +49,12 @@
4949
</licenses>
5050

5151
<properties>
52-
<spring-framework.version>6.2.3</spring-framework.version>
53-
<spring-security.version>6.4.2</spring-security.version>
54-
<netty.version>4.1.118.Final</netty.version>
5552
<grpc.version>1.70.0</grpc.version>
5653
<protobuf-java.version>3.25.6</protobuf-java.version>
5754
<google-common-protos.version>2.46.0</google-common-protos.version>
5855
<micrometer.version>1.13.6</micrometer.version>
5956
<reactor-grpc.version>1.2.4</reactor-grpc.version>
57+
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
6058
</properties>
6159

6260
<dependencyManagement>
@@ -91,30 +89,15 @@
9189
<artifactId>spring-grpc-server-web-spring-boot-starter</artifactId>
9290
<version>${project.version}</version>
9391
</dependency>
94-
<!-- Utilities -->
9592
<dependency>
9693
<groupId>org.springframework.grpc</groupId>
9794
<artifactId>spring-grpc-test</artifactId>
9895
<version>${project.version}</version>
9996
</dependency>
10097
<dependency>
101-
<groupId>org.springframework</groupId>
102-
<artifactId>spring-framework-bom</artifactId>
103-
<version>${spring-framework.version}</version>
104-
<type>pom</type>
105-
<scope>import</scope>
106-
</dependency>
107-
<dependency>
108-
<groupId>org.springframework.security</groupId>
109-
<artifactId>spring-security-bom</artifactId>
110-
<version>${spring-security.version}</version>
111-
<type>pom</type>
112-
<scope>import</scope>
113-
</dependency>
114-
<dependency>
115-
<groupId>io.netty</groupId>
116-
<artifactId>netty-bom</artifactId>
117-
<version>${netty.version}</version>
98+
<groupId>io.grpc</groupId>
99+
<artifactId>grpc-bom</artifactId>
100+
<version>${grpc.version}</version>
118101
<type>pom</type>
119102
<scope>import</scope>
120103
</dependency>
@@ -130,33 +113,35 @@
130113
<artifactId>protoc</artifactId>
131114
<version>${protobuf-java.version}</version>
132115
</dependency>
133-
<dependency>
134-
<groupId>io.grpc</groupId>
135-
<artifactId>grpc-bom</artifactId>
136-
<version>${grpc.version}</version>
137-
<type>pom</type>
138-
<scope>import</scope>
139-
</dependency>
140116
<dependency>
141117
<groupId>com.google.api.grpc</groupId>
142118
<artifactId>proto-google-common-protos</artifactId>
143119
<version>${google-common-protos.version}</version>
144120
</dependency>
145-
<dependency>
146-
<groupId>io.micrometer</groupId>
147-
<artifactId>micrometer-bom</artifactId>
148-
<version>${micrometer.version}</version>
149-
<type>pom</type>
150-
<scope>import</scope>
151-
</dependency>
152-
<dependency>
153-
<groupId>com.salesforce.servicelibs</groupId>
154-
<artifactId>reactor-grpc-stub</artifactId>
155-
<version>${reactor-grpc.version}</version>
156-
</dependency>
157121
</dependencies>
158122
</dependencyManagement>
159123

124+
<build>
125+
<plugins>
126+
<plugin>
127+
<groupId>io.spring.javaformat</groupId>
128+
<artifactId>spring-javaformat-maven-plugin</artifactId>
129+
<version>${spring-javaformat-maven-plugin.version}</version>
130+
<executions>
131+
<execution>
132+
<phase>validate</phase>
133+
<configuration>
134+
<skip>true</skip>
135+
</configuration>
136+
<goals>
137+
<goal>validate</goal>
138+
</goals>
139+
</execution>
140+
</executions>
141+
</plugin>
142+
</plugins>
143+
</build>
144+
160145
<profiles>
161146
<profile>
162147
<id>staging</id>

0 commit comments

Comments
 (0)