Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent replacement of properties #194

Closed
reitzmichnicht opened this issue May 31, 2022 · 7 comments
Closed

Prevent replacement of properties #194

reitzmichnicht opened this issue May 31, 2022 · 7 comments
Assignees

Comments

@reitzmichnicht
Copy link
Contributor

reitzmichnicht commented May 31, 2022

I don't know which version introduced the changed behaviour. I'm using version 8.0.0 now and I have a section like this in the pom.xml

<properties>
<project.build.outputTimestamp>${git.commit.timestamp.datetime}</project.build.outputTimestamp>
</properties>

Everytime I run mvn commands like this:
mvn versions:set -DnewVersion=1.2.3-SNAPSHOT
The placeholder is replaced with the timestamp in the original pom.xml although I have not enabled any updatePom setting.

@qoomon qoomon self-assigned this May 31, 2022
@qoomon qoomon added the bug label May 31, 2022
@qoomon
Copy link
Owner

qoomon commented Jun 1, 2022

That is strange, I'll investigate.

@qoomon
Copy link
Owner

qoomon commented Jun 1, 2022

I was able to reproduce your bug. Give me some days and I'll try fixing it

@qoomon
Copy link
Owner

qoomon commented Jun 5, 2022

It turns out this behaviour is not caused by the maven-git-versioning-extension. If I run mvn versions:set -DnewVersion=1.2.3 and the pom version was not equals to 1.2.3 and there is a <project.build.outputTimestamp> property defined than this property gets set by the maven versions plugin.

@qoomon
Copy link
Owner

qoomon commented Jun 5, 2022

This versions-maven-plugin behaviour was introduced by this merge mojohaus/versions#522. So this behaviour is pretty new.

@qoomon
Copy link
Owner

qoomon commented Jun 5, 2022

I'm thinking about implement the same logic. Means override <project.build.outputTimestamp> with commit timestamp, if property is present. So you don't have to have a property like <project.build.outputTimestamp>${git.commit.timestamp.datetime}</project.build.outputTimestamp>.

WDYT?

BTW I plan to remove basically all ${git....} properties, because they are not resolved by default and therefore their values are not part of the published pom.xml. Instead you should make use of the <properties> within the extension config file e.g.

<ref type="branch">
    <pattern>.+</pattern>
    <version>${ref}-SNAPSHOT</version>
    <properties>
        <foo>${commit.timestamp.datetime}</foo>
    </properties>
</ref>

@qoomon qoomon removed the bug label Jun 5, 2022
@reitzmichnicht
Copy link
Contributor Author

Sorry about filling non related bugs here, but thanks for the investigation. Always a joy to see new features introduced with changing the old defaults.

For me it would also be fine to define/use the git properties via the extension config.
With the release process our highest problem is that we still want to use some checks of the release:prepare step and that this relies on a snapshot version defined, so the whole process is segregated into steps with this extension enabled/disabled

Kind regards,
Michael

@qoomon qoomon closed this as completed Jun 7, 2022
@qoomon
Copy link
Owner

qoomon commented Aug 15, 2022

Following merge of the version plugin adds an option to set behaviour of updating of project.build.outputTimestamp see mojohaus/versions#630

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants