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.
This commit is contained in:
Dave Syer
2024-10-21 16:45:53 +01:00
parent 0b98da4c49
commit 24a797ee4b
4 changed files with 163 additions and 93 deletions

65
pom.xml
View File

@@ -74,13 +74,6 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<!-- production dependencies -->
<spring-framework.version>6.1.14</spring-framework.version>
<netty.version>4.1.113.Final</netty.version>
<grpc.version>1.63.2</grpc.version>
<protobuf-java.version>3.25.5</protobuf-java.version>
<google-common-protos.version>2.46.0</google-common-protos.version>
<!-- internal dependencies -->
<spring-boot.version>3.3.4</spring-boot.version>
<jackson.version>2.17.2</jackson.version>
@@ -97,6 +90,7 @@
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-flatten-plugin.version>1.6.0</maven-flatten-plugin.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
@@ -185,6 +179,31 @@
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${maven-flatten-plugin.version}</version>
<inherited>true</inherited>
<executions>
<execution>
<!-- Tidy up all POMs before they are published -->
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>oss</flattenMode>
<pomElements>
<parent>expand</parent>
<distributionManagement>remove</distributionManagement>
<repositories>remove</repositories>
</pomElements>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -380,38 +399,12 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring-framework.version}</version>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-dependencies</artifactId>
<version>${project.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>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>${protobuf-java.version}</version>
<type>pom</type>
<scope>import</scope>
</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>
</dependencies>
</dependencyManagement>

View File

@@ -4,13 +4,9 @@
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>
<parent>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<groupId>org.springframework.grpc</groupId>
<artifactId>spring-grpc-dependencies</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring gRPC dependencies</name>
@@ -24,6 +20,34 @@
<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>
<properties>
<spring-framework.version>6.1.14</spring-framework.version>
<netty.version>4.1.113.Final</netty.version>
<grpc.version>1.63.2</grpc.version>
<protobuf-java.version>3.25.5</protobuf-java.version>
<google-common-protos.version>2.46.0</google-common-protos.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
@@ -47,7 +71,67 @@
<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>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>${protobuf-java.version}</version>
<type>pom</type>
<scope>import</scope>
</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>
</dependencies>
</dependencyManagement>
</project>
<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>
</profiles>
</project>

View File

@@ -1 +1 @@
!package.json
!package.json

View File

@@ -48,25 +48,6 @@
</extension>
</extensions>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${maven-frontend-plugin.version}</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
</executions>
<configuration>
<!-- Has to be the same as the antora lifecycle-->
<nodeVersion>v18.17.1</nodeVersion>
</configuration>
</plugin>
<plugin>
<groupId>io.spring.maven.antora</groupId>
<artifactId>antora-maven-plugin</artifactId>
@@ -139,36 +120,6 @@
</arguments>
</configuration>
</execution>
<execution>
<id>generate-readme</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/node_modules/.bin/downdoc</executable>
<arguments>
<argument>${project.build.directory}/README.adoc</argument>
<argument>-o</argument>
<argument>${project.parent.basedir}/README.md</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>generate-contributing</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/node_modules/.bin/downdoc</executable>
<arguments>
<argument>${project.build.directory}/CONTRIBUTING.adoc</argument>
<argument>-o</argument>
<argument>${project.parent.basedir}/CONTRIBUTING.md</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
@@ -212,6 +163,48 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${maven-frontend-plugin.version}</version>
<executions>
<execution>
<?m2e ignore?>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<?m2e ignore?>
<id>generate-readme</id>
<goals>
<goal>npx</goal>
</goals>
<phase>package</phase>
<configuration>
<arguments>downdoc ${project.build.directory}/README.adoc -o ${project.parent.basedir}/README.md</arguments>
</configuration>
</execution>
<execution>
<?m2e ignore?>
<id>generate-contributing</id>
<goals>
<goal>npx</goal>
</goals>
<phase>package</phase>
<configuration>
<arguments>downdoc ${project.build.directory}/CONTRIBUTING.adoc -o ${project.parent.basedir}/CONTRIBUTING.md</arguments>
</configuration>
</execution>
</executions>
<configuration>
<!-- Has to be the same as the antora lifecycle-->
<nodeVersion>v18.17.1</nodeVersion>
</configuration>
</plugin>
</plugins>
</build>