Skip to content

Commit 07342f8

Browse files
author
Dave Syer
committed
Reinstate flatten plugin
The problem with the flatten plugin is that it unconditionally nukes the dependency management section, which we very much need in our "dependencies" modules. The key is to make the "dependencies" pom independent of the main reactor (pattern copied form Spring Cloud). Then you can run flatten in the main reactor build and not in the dependencies, which then retain there useful properties and dependency management.
1 parent 0b98da4 commit 07342f8

File tree

4 files changed

+136
-93
lines changed

4 files changed

+136
-93
lines changed

pom.xml

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@
7474
<maven.compiler.source>17</maven.compiler.source>
7575
<maven.compiler.target>17</maven.compiler.target>
7676

77-
<!-- production dependencies -->
78-
<spring-framework.version>6.1.14</spring-framework.version>
79-
<netty.version>4.1.113.Final</netty.version>
80-
<grpc.version>1.63.2</grpc.version>
81-
<protobuf-java.version>3.25.5</protobuf-java.version>
82-
<google-common-protos.version>2.46.0</google-common-protos.version>
83-
8477
<!-- internal dependencies -->
8578
<spring-boot.version>3.3.4</spring-boot.version>
8679
<jackson.version>2.17.2</jackson.version>
@@ -97,6 +90,7 @@
9790
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
9891
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
9992
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
93+
<maven-flatten-plugin.version>1.6.0</maven-flatten-plugin.version>
10094
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
10195
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
10296
<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
@@ -185,6 +179,31 @@
185179
<artifactId>maven-deploy-plugin</artifactId>
186180
<version>${maven-deploy-plugin.version}</version>
187181
</plugin>
182+
<plugin>
183+
<groupId>org.codehaus.mojo</groupId>
184+
<artifactId>flatten-maven-plugin</artifactId>
185+
<version>${maven-flatten-plugin.version}</version>
186+
<inherited>true</inherited>
187+
<executions>
188+
<execution>
189+
<!-- Tidy up all POMs before they are published -->
190+
<id>flatten</id>
191+
<phase>process-resources</phase>
192+
<goals>
193+
<goal>flatten</goal>
194+
</goals>
195+
<configuration>
196+
<updatePomFile>true</updatePomFile>
197+
<flattenMode>oss</flattenMode>
198+
<pomElements>
199+
<parent>expand</parent>
200+
<distributionManagement>remove</distributionManagement>
201+
<repositories>remove</repositories>
202+
</pomElements>
203+
</configuration>
204+
</execution>
205+
</executions>
206+
</plugin>
188207
</plugins>
189208
</build>
190209

@@ -380,38 +399,12 @@
380399
<dependencyManagement>
381400
<dependencies>
382401
<dependency>
383-
<groupId>org.springframework</groupId>
384-
<artifactId>spring-framework-bom</artifactId>
385-
<version>${spring-framework.version}</version>
402+
<groupId>org.springframework.grpc</groupId>
403+
<artifactId>spring-grpc-dependencies</artifactId>
404+
<version>${project.version}</version>
386405
<type>pom</type>
387406
<scope>import</scope>
388407
</dependency>
389-
<dependency>
390-
<groupId>io.netty</groupId>
391-
<artifactId>netty-bom</artifactId>
392-
<version>${netty.version}</version>
393-
<type>pom</type>
394-
<scope>import</scope>
395-
</dependency>
396-
<dependency>
397-
<groupId>com.google.protobuf</groupId>
398-
<artifactId>protobuf-bom</artifactId>
399-
<version>${protobuf-java.version}</version>
400-
<type>pom</type>
401-
<scope>import</scope>
402-
</dependency>
403-
<dependency>
404-
<groupId>io.grpc</groupId>
405-
<artifactId>grpc-bom</artifactId>
406-
<version>${grpc.version}</version>
407-
<type>pom</type>
408-
<scope>import</scope>
409-
</dependency>
410-
<dependency>
411-
<groupId>com.google.api.grpc</groupId>
412-
<artifactId>proto-google-common-protos</artifactId>
413-
<version>${google-common-protos.version}</version>
414-
</dependency>
415408
</dependencies>
416409
</dependencyManagement>
417410

spring-grpc-dependencies/pom.xml

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<parent>
8-
<groupId>org.springframework.grpc</groupId>
9-
<artifactId>spring-grpc</artifactId>
10-
<version>0.1.0-SNAPSHOT</version>
11-
</parent>
12-
7+
<groupId>org.springframework.grpc</groupId>
138
<artifactId>spring-grpc-dependencies</artifactId>
9+
<version>0.1.0-SNAPSHOT</version>
1410
<packaging>pom</packaging>
1511

1612
<name>Spring gRPC dependencies</name>
@@ -24,6 +20,34 @@
2420
<developerConnection>[email protected]:spring-projects-experimental/spring-grpc.git</developerConnection>
2521
</scm>
2622

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+
<properties>
44+
<spring-framework.version>6.1.14</spring-framework.version>
45+
<netty.version>4.1.113.Final</netty.version>
46+
<grpc.version>1.63.2</grpc.version>
47+
<protobuf-java.version>3.25.5</protobuf-java.version>
48+
<google-common-protos.version>2.46.0</google-common-protos.version>
49+
</properties>
50+
2751
<dependencyManagement>
2852
<dependencies>
2953
<dependency>
@@ -47,7 +71,40 @@
4771
<artifactId>spring-grpc-test</artifactId>
4872
<version>${project.version}</version>
4973
</dependency>
74+
<dependency>
75+
<groupId>org.springframework</groupId>
76+
<artifactId>spring-framework-bom</artifactId>
77+
<version>${spring-framework.version}</version>
78+
<type>pom</type>
79+
<scope>import</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>io.netty</groupId>
83+
<artifactId>netty-bom</artifactId>
84+
<version>${netty.version}</version>
85+
<type>pom</type>
86+
<scope>import</scope>
87+
</dependency>
88+
<dependency>
89+
<groupId>com.google.protobuf</groupId>
90+
<artifactId>protobuf-bom</artifactId>
91+
<version>${protobuf-java.version}</version>
92+
<type>pom</type>
93+
<scope>import</scope>
94+
</dependency>
95+
<dependency>
96+
<groupId>io.grpc</groupId>
97+
<artifactId>grpc-bom</artifactId>
98+
<version>${grpc.version}</version>
99+
<type>pom</type>
100+
<scope>import</scope>
101+
</dependency>
102+
<dependency>
103+
<groupId>com.google.api.grpc</groupId>
104+
<artifactId>proto-google-common-protos</artifactId>
105+
<version>${google-common-protos.version}</version>
106+
</dependency>
50107
</dependencies>
51108
</dependencyManagement>
52109

53-
</project>
110+
</project>

spring-grpc-docs/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
!package.json
1+
!package.json

spring-grpc-docs/pom.xml

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,6 @@
4848
</extension>
4949
</extensions>
5050
<plugins>
51-
<plugin>
52-
<groupId>com.github.eirslett</groupId>
53-
<artifactId>frontend-maven-plugin</artifactId>
54-
<version>${maven-frontend-plugin.version}</version>
55-
<executions>
56-
<execution>
57-
<id>install node and npm</id>
58-
<goals>
59-
<goal>install-node-and-npm</goal>
60-
<goal>npm</goal>
61-
</goals>
62-
<phase>generate-resources</phase>
63-
</execution>
64-
</executions>
65-
<configuration>
66-
<!-- Has to be the same as the antora lifecycle-->
67-
<nodeVersion>v18.17.1</nodeVersion>
68-
</configuration>
69-
</plugin>
7051
<plugin>
7152
<groupId>io.spring.maven.antora</groupId>
7253
<artifactId>antora-maven-plugin</artifactId>
@@ -139,36 +120,6 @@
139120
</arguments>
140121
</configuration>
141122
</execution>
142-
<execution>
143-
<id>generate-readme</id>
144-
<phase>package</phase>
145-
<goals>
146-
<goal>exec</goal>
147-
</goals>
148-
<configuration>
149-
<executable>${basedir}/node_modules/.bin/downdoc</executable>
150-
<arguments>
151-
<argument>${project.build.directory}/README.adoc</argument>
152-
<argument>-o</argument>
153-
<argument>${project.parent.basedir}/README.md</argument>
154-
</arguments>
155-
</configuration>
156-
</execution>
157-
<execution>
158-
<id>generate-contributing</id>
159-
<phase>package</phase>
160-
<goals>
161-
<goal>exec</goal>
162-
</goals>
163-
<configuration>
164-
<executable>${basedir}/node_modules/.bin/downdoc</executable>
165-
<arguments>
166-
<argument>${project.build.directory}/CONTRIBUTING.adoc</argument>
167-
<argument>-o</argument>
168-
<argument>${project.parent.basedir}/CONTRIBUTING.md</argument>
169-
</arguments>
170-
</configuration>
171-
</execution>
172123
</executions>
173124
</plugin>
174125
<plugin>
@@ -212,6 +163,48 @@
212163
</execution>
213164
</executions>
214165
</plugin>
166+
<plugin>
167+
<groupId>com.github.eirslett</groupId>
168+
<artifactId>frontend-maven-plugin</artifactId>
169+
<version>${maven-frontend-plugin.version}</version>
170+
<executions>
171+
<execution>
172+
<?m2e ignore?>
173+
<id>install node and npm</id>
174+
<goals>
175+
<goal>install-node-and-npm</goal>
176+
<goal>npm</goal>
177+
</goals>
178+
<phase>generate-resources</phase>
179+
</execution>
180+
<execution>
181+
<?m2e ignore?>
182+
<id>generate-readme</id>
183+
<goals>
184+
<goal>npx</goal>
185+
</goals>
186+
<phase>package</phase>
187+
<configuration>
188+
<arguments>downdoc ${project.build.directory}/README.adoc -o ${project.parent.basedir}/README.md</arguments>
189+
</configuration>
190+
</execution>
191+
<execution>
192+
<?m2e ignore?>
193+
<id>generate-contributing</id>
194+
<goals>
195+
<goal>npx</goal>
196+
</goals>
197+
<phase>package</phase>
198+
<configuration>
199+
<arguments>downdoc ${project.build.directory}/CONTRIBUTING.adoc -o ${project.parent.basedir}/CONTRIBUTING.md</arguments>
200+
</configuration>
201+
</execution>
202+
</executions>
203+
<configuration>
204+
<!-- Has to be the same as the antora lifecycle-->
205+
<nodeVersion>v18.17.1</nodeVersion>
206+
</configuration>
207+
</plugin>
215208
</plugins>
216209
</build>
217210

0 commit comments

Comments
 (0)