Skip to content

Commit 9131e6a

Browse files
authored
GH-480: Bring back POM revision property (#481)
Fixes: #480 * Add `flatten-maven-plugin` to resolve properties and remove unnecessary build info from the final POM of the artifact to install/deploy * Revert `version` extraction from POM via `sed` command in the build action * Remove `flatten.clean` from the Maven Flatter Plugin, since `.flattened-pom.xml` generated file is landed in the `/target` dir * Add `pomElements/profiles` for removal in the result `.flattened-pom.xml`
1 parent 72a0d0e commit 9131e6a

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/actions/build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ runs:
3939
id: read-version
4040
shell: bash
4141
run: |
42-
version=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
42+
version=$(sed -n 's/^.*<revision>\(.*\)<\/revision>.*$/\1/p' pom.xml)
4343
echo "Version is $version"
4444
echo "version=$version" >> $GITHUB_OUTPUT

pom.xml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>org.springframework.retry</groupId>
77
<artifactId>spring-retry</artifactId>
8-
<version>2.0.12-SNAPSHOT</version>
8+
<version>${revision}</version>
99
<name>Spring Retry</name>
1010
<description><![CDATA[
1111
Spring Retry provides an abstraction around retrying failed operations, with an
@@ -26,6 +26,7 @@
2626
</license>
2727
</licenses>
2828
<properties>
29+
<revision>2.0.12-SNAPSHOT</revision>
2930
<disable.checks>false</disable.checks>
3031
<java.version>17</java.version>
3132
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -302,6 +303,27 @@
302303
</execution>
303304
</executions>
304305
</plugin>
306+
<plugin>
307+
<groupId>org.codehaus.mojo</groupId>
308+
<artifactId>flatten-maven-plugin</artifactId>
309+
<version>1.6.0</version>
310+
<configuration>
311+
<outputDirectory>${project.build.directory}</outputDirectory>
312+
<flattenMode>oss</flattenMode>
313+
<pomElements>
314+
<profiles>remove</profiles>
315+
</pomElements>
316+
</configuration>
317+
<executions>
318+
<execution>
319+
<id>flatten</id>
320+
<phase>process-resources</phase>
321+
<goals>
322+
<goal>flatten</goal>
323+
</goals>
324+
</execution>
325+
</executions>
326+
</plugin>
305327
</plugins>
306328
</build>
307329

0 commit comments

Comments
 (0)