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

@{version} doesn't get resolved in <tagReleaseMessage> #113

Closed
Wavemaster111188 opened this issue Jul 13, 2018 · 6 comments
Closed

@{version} doesn't get resolved in <tagReleaseMessage> #113

Wavemaster111188 opened this issue Jul 13, 2018 · 6 comments

Comments

@Wavemaster111188
Copy link

Problem

If you use @{version} in a tag it simply isn't applied (instead it shows the plain text "@{version}").

Reason

This is because the properties map is not taken into account for tagging.

The following code is executed in gitCommit but not in gitTag:

       if (map != null) {
            for (Entry<String, String> entr : map.entrySet()) {
                message = StringUtils.replace(message, "@{" + entr.getKey()
                        + "}", entr.getValue());
            }
        }

Solution

The solution would be to add a gitTag(final String tagName, final String message, boolean gpgSignTag , Map<String, String> map) method and use the above code in the method.

Then in all tagging Mojos, the new method should be used.

I see no downside in this behaviour.

(this is my very first public issue ever so please help me if I'm done something wrong)

@aleksandr-m
Copy link
Owner

@Wavemaster111188 You can use maven ${project.version} in tag messages. It should work because when tagging is done the version in pom is not changed yet. Try it out.

@Wavemaster111188
Copy link
Author

@aleksandr-m
The ${project.version} resolves to the SNAPSHOT version of the current release (if I tag 1.2.3.4, it resolves to 1.2.3.4-SNAPSHOT)

For annotating tags, I need the released version, not the SNAPSHOT, therefore the issue.

@aleksandr-m
Copy link
Owner

@Wavemaster111188 Yes. I didn't change the branch so for me it was correct version. Done.

@Wavemaster111188
Copy link
Author

Awesome!
Thanks a lot.

@testphreak
Copy link

@aleksandr-m thank you for releasing the new version! Can you share more about this @{version} property and how it can be used with this plugin? I looked for examples but didn't come across any except that it can be used as custom property in commit messages.

Wondering if I can use @{version} inside postReleaseGoals to set the release version instead of the snapshot version, something like -DcustomVersion=@{version}. If I use ${project.version} it uses the snapshot version.

@aleksandr-m
Copy link
Owner

@testphreak Currently no. Right now it can be used only in commit/tag messages. Planning to replace it with proper Maven property which can be used that way as you've described.

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

3 participants