Skip to content

Commit f0a84ce

Browse files
author
Dave Syer
committed
Sack the flatten plugin, at least till it works
1 parent 9b89bf2 commit f0a84ce

File tree

4 files changed

+73
-91
lines changed

4 files changed

+73
-91
lines changed

README.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,34 @@ or for Gradle:
2626
implementation 'org.springframework.grpc:spring-grpc-spring-boot-autoconfigure:0.1.0-SNAPSHOT'
2727
```
2828

29+
For convenience, you can use the Spring gRPC BOM to manage dependencies. With Maven:
30+
31+
```xml
32+
<dependencyManagement>
33+
<dependencies>
34+
<dependency>
35+
<groupId>org.springframework.grpc</groupId>
36+
<artifactId>spring-grpc-bom</artifactId>
37+
<version>0.1.0-SNAPSHOT</version>
38+
<type>pom</type>
39+
<scope>import</scope>
40+
</dependency>
41+
</dependencies>
42+
</dependencyManagement>
43+
```
44+
45+
or Gradle:
46+
47+
```groovy
48+
dependencyManagement {
49+
imports {
50+
mavenBom 'org.springframework.grpc:spring-grpc-bom:0.1.0-SNAPSHOT'
51+
}
52+
}
53+
```
54+
55+
Then you can omit the version from the dependencies.
56+
2957
You need a Protobuf file that defines your service and messages, and you will need to configure your build tools to compile it into Java sources. This is a standard part of gRPC development (i.e. nothing to do with Spring). We now come to the Spring gRPC features.
3058

3159
### gPRC Server
@@ -54,25 +82,6 @@ public class GrpcServerApplication {
5482

5583
Run it from your IDE, or on the command line with `mvn spring-boot:run` or `gradle bootRun`.
5684

57-
For convenience, you can use the Spring gRPC BOM to manage dependencies:
58-
59-
```xml
60-
<dependencyManagement>
61-
<dependencies>
62-
<dependency>
63-
<groupId>org.springframework.grpc</groupId>
64-
<artifactId>spring-grpc-bom</artifactId>
65-
<version>0.1.0-SNAPSHOT</version>
66-
<type>pom</type>
67-
<scope>import</scope>
68-
</dependency>
69-
</dependencies>
70-
</dependencyManagement>
71-
```
72-
73-
Then you can omit the version from the dependencies:
74-
75-
7685
### gRPC Client
7786

7887
To create a simple gRPC client, you can use the Spring Boot starter (see above - it's the same as for the server). Then you can inject a bean of type `GrpcChannelFactory` and use it to create a gRPC channel. The most common usage of a channel is to create a client that binds to a service, such as the one above. The Protobuf-generated sources in your project will contain the stub classes, and they just need to be bound to a channel. For example, to bind to the `SimpleGrpc` service on a local server:

pom.xml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
104104
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
105105
<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
106-
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
107106
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
108107
<asciidoctor-maven-plugin.version>2.2.3</asciidoctor-maven-plugin.version>
109108
<maven-assembly-plugin.version>3.7.0</maven-assembly-plugin.version>
@@ -183,39 +182,6 @@
183182
</execution>
184183
</executions>
185184
</plugin>
186-
<plugin>
187-
<groupId>org.codehaus.mojo</groupId>
188-
<artifactId>flatten-maven-plugin</artifactId>
189-
<version>${flatten-maven-plugin.version}</version>
190-
<executions>
191-
<execution>
192-
<id>flatten</id>
193-
<phase>process-resources</phase>
194-
<goals>
195-
<goal>flatten</goal>
196-
</goals>
197-
<configuration>
198-
<updatePomFile>true</updatePomFile>
199-
<flattenMode>ossrh</flattenMode>
200-
<pomElements>
201-
<distributionManagement>remove</distributionManagement>
202-
<dependencyManagement>remove</dependencyManagement>
203-
<repositories>remove</repositories>
204-
<scm>keep</scm>
205-
<url>keep</url>
206-
<organization>resolve</organization>
207-
</pomElements>
208-
</configuration>
209-
</execution>
210-
<execution>
211-
<id>clean</id>
212-
<phase>clean</phase>
213-
<goals>
214-
<goal>clean</goal>
215-
</goals>
216-
</execution>
217-
</executions>
218-
</plugin>
219185
<plugin>
220186
<groupId>org.apache.maven.plugins</groupId>
221187
<artifactId>maven-deploy-plugin</artifactId>

samples/grpc-server/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
<type>pom</type>
4343
<scope>import</scope>
4444
</dependency>
45+
<dependency>
46+
<groupId>org.springframework.grpc</groupId>
47+
<artifactId>spring-grpc</artifactId>
48+
<version>0.1.0-SNAPSHOT</version>
49+
<type>pom</type>
50+
<scope>import</scope>
51+
</dependency>
4552
</dependencies>
4653
</dependencyManagement>
4754
<dependencies>
@@ -140,4 +147,42 @@
140147
</plugins>
141148
</build>
142149

150+
<repositories>
151+
<repository>
152+
<id>spring-milestones</id>
153+
<name>Spring Milestones</name>
154+
<url>https://repo.spring.io/milestone</url>
155+
<snapshots>
156+
<enabled>false</enabled>
157+
</snapshots>
158+
</repository>
159+
<repository>
160+
<id>spring-snapshots</id>
161+
<name>Spring Snapshots</name>
162+
<url>https://repo.spring.io/snapshot</url>
163+
<releases>
164+
<enabled>false</enabled>
165+
</releases>
166+
</repository>
167+
</repositories>
168+
<pluginRepositories>
169+
<pluginRepository>
170+
<id>spring-milestones</id>
171+
<name>Spring Milestones</name>
172+
<url>https://repo.spring.io/milestone</url>
173+
<snapshots>
174+
<enabled>false</enabled>
175+
</snapshots>
176+
</pluginRepository>
177+
<pluginRepository>
178+
<id>spring-snapshots</id>
179+
<name>Spring Snapshots</name>
180+
<url>https://repo.spring.io/snapshot</url>
181+
<releases>
182+
<enabled>false</enabled>
183+
</releases>
184+
</pluginRepository>
185+
</pluginRepositories>
186+
187+
143188
</project>

spring-grpc-bom/pom.xml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -49,42 +49,4 @@
4949
</dependencies>
5050
</dependencyManagement>
5151

52-
<build>
53-
<plugins>
54-
<plugin>
55-
<groupId>org.codehaus.mojo</groupId>
56-
<artifactId>flatten-maven-plugin</artifactId>
57-
<version>${flatten-maven-plugin.version}</version>
58-
<executions>
59-
<execution>
60-
<id>flatten</id>
61-
<phase>process-resources</phase>
62-
<goals>
63-
<goal>flatten</goal>
64-
</goals>
65-
<configuration>
66-
<updatePomFile>true</updatePomFile>
67-
<flattenMode>ossrh</flattenMode>
68-
<pomElements>
69-
<distributionManagement>remove</distributionManagement>
70-
<dependencyManagement>keep</dependencyManagement>
71-
<repositories>remove</repositories>
72-
<scm>keep</scm>
73-
<url>keep</url>
74-
<organization>resolve</organization>
75-
</pomElements>
76-
</configuration>
77-
</execution>
78-
<execution>
79-
<id>clean</id>
80-
<phase>clean</phase>
81-
<goals>
82-
<goal>clean</goal>
83-
</goals>
84-
</execution>
85-
</executions>
86-
</plugin>
87-
</plugins>
88-
</build>
89-
9052
</project>

0 commit comments

Comments
 (0)