mojohaus / versions

Versions Maven Plugin
https://www.mojohaus.org/versions/versions-maven-plugin/
Apache License 2.0
337 stars 267 forks source link

Add goal to replace CI friendly placeholders during install/deploy phase #450

Closed mtamme closed 2 years ago

mtamme commented 3 years ago

Hi!

I am aware of the flatten-maven-plugin which is suggested on the Maven Website (https://maven.apache.org/maven-ci-friendly.html) to replace the CI friendly placeholders. Since the flatten-maven-plugin messes up the whole POM while replacing the placeholders the versions-maven-plugin does a much cleaner job when it comes to changing the version within a multi-module project.

So my question is, would it be possible to introduce a new goal for the versions-maven-plugin to only handle the CI friendly placeholders during install and deploy phase? I found a Maven extension on GitHub which actually does something comparable with a MetadataGenerator from the Aether project.

https://github.com/jcgay/unique-revision-maven-filtering/blob/master/src/main/java/fr/jcgay/maven/extension/revision/UniqueRevisionFiltering.java

Since the CI friendly placeholders are all about the version I thought it would fit nicely into the version-maven-plugin.

Thanks Martin

joel-schaal commented 1 year ago

It's sad this got closed without even a comment. I'm facing the same issue and would have expected to find some support of CI Friendly from this plugin

slawekjaranowski commented 1 year ago

Does flattenMode = resolveCiFriendliesOnly do what you need?

https://www.mojohaus.org/flatten-maven-plugin/flatten-mojo.html#flattenMode

slawekjaranowski commented 1 year ago

Issue was closed by bot due to long inactivate ... I have improved this bot to add proper message 30 days before closing.

joel-schaal commented 1 year ago

Does flattenMode = resolveCiFriendliesOnly do what you need?

I have tried it like that :

mvn flatten:flatten -DflattenMode=resolveCiFriendliesOnly -DflattenedPomFilename=pom.xml -Dchangelist=42

But I experienced the same issue as OP:

Since the flatten-maven-plugin messes up the whole POM while replacing the placeholders

The indentation changed (from 4 to 2) and the order of the elements too. Since I'm doing this to prepare a commit, I don't like messing the Git history with that kind of change.