GH-480: Bring back POM revision property#481
Conversation
Fixes: spring-projects#480 * Add `flatten-maven-plugin` to resolve properties and remove unnecessary build info from the final POM of the artifact to install/deploy
|
The final result is as simple as this: <?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>2.0.12-SNAPSHOT</version>
<name>Spring Retry</name>
<description>Spring Retry provides an abstraction around retrying failed operations, with an
emphasis on declarative control of the process and policy-based behaviour that is
easy to extend and customize. For instance, you can configure a plain POJO
operation to retry if it fails, based on the type of exception, and with a fixed
or exponential backoff.</description>
<url>https://github.com/spring-projects/spring-retry</url>
<organization>
<name>Spring IO</name>
<url>https://spring.io</url>
</organization>
<licenses>
<license>
<name>Apache 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>dsyer</id>
<name>Dave Syer</name>
<email>david.syer@broadcom.com</email>
</developer>
<developer>
<id>garyrussell</id>
<name>Gary Russell</name>
<email>github@gprussell.net</email>
</developer>
<developer>
<id>artembilan</id>
<name>Artem Bilan</name>
<email>artem.bilan@broadcom.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/spring-projects/spring-retry.git</connection>
<developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-retry.git</developerConnection>
<url>https://github.com/spring-projects/spring-retry</url>
</scm>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>6.0.23</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.10.13</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.8.6</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
<profiles>
<profile>
<id>spring</id>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
</profile>
</profiles>
</project>Pay attention to the |
snicoll
left a comment
There was a problem hiding this comment.
How about reverting the change in the release pipeline as well?
It should also add .flattened-pom.xml in .gitignore.
| <id>flatten.clean</id> | ||
| <phase>clean</phase> | ||
| <goals> | ||
| <goal>clean</goal> |
There was a problem hiding this comment.
The clean goal does not need the configuration about flatten mode and the rest of it. Given it is specific to the flatten goal, it should be moved there for consistency.
There was a problem hiding this comment.
Not sure what you mean, but indeed don’t need clean here at all since I made the flatten result be in the target dir, which is cleaned by standard goal. Plus that would make no need for the gitignore as well.
|
Hey, Stephan! |
* 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`
snicoll
left a comment
There was a problem hiding this comment.
.flattened-pom.xml is still missing in .gitignore.
| <artifactId>flatten-maven-plugin</artifactId> | ||
| <version>1.6.0</version> | ||
| <configuration> | ||
| <outputDirectory>${project.build.directory}</outputDirectory> |
There was a problem hiding this comment.
.flattened-pom.xml is still missing in .gitignore.
We don't need that because the file is stored into a target directory which is already under ignore.
I don't see any argument why this file has to be in the root project dir when we are interested in it only at runtime on install or deploy, so that is indeed a volatile entity for project build lifecycle and that is totally enough to have it in the target alongside with the rest of artifacts to deliver.
There was a problem hiding this comment.
If you do that, you don't need clean then. Again, if you decide to do things differently, please do that consistently.
There was a problem hiding this comment.
Right. That’s what I did in the last commit. Please, double check the latest change set in the PR
Fixes: #480
flatten-maven-pluginto resolve properties and remove unnecessary build info from the final POM of the artifact to install/deploy