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

Only bump Maven plugin version property when needed #4517

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

timtebeek
Copy link
Contributor

Any additional context

As pointed out via Slack: https://rewriteoss.slack.com/archives/C01A843MWG5/p1726844234112149?thread_ts=1725959799.580249&cid=C01A843MWG5

it seems that the issue is due to the tag being visited again after updating the property. I added some logs in the if-elseif check that you mentioned earlier and got the output after running the test with profiles.

if (version.trim().startsWith("${") && !newVersion.equals(getResolutionResult().getPom().getValue(version.trim()))) {
    System.out.println("IF: Updating property: " + version);
    doAfterVisit(new ChangePropertyValue(version, newVersion, false, false).getVisitor());
} else if (!newVersion.equals(version)) {
    System.out.printf("ELSEIF: version: %s, new-version: %s, resolved: %s\n", version, newVersion, getResolutionResult().getPom().getValue(version.trim()));
    doAfterVisit(new ChangeTagValueVisitor<>(versionTag.get(), newVersion));
}

I couldn't understand why it is being visited twice, but a simple fix would be to move newVersion.equals(getResolutionResult().getPom().getValue(version.trim())) inside if instead of &&.
It'd be great if you can confirm this. (edited)

@timtebeek timtebeek added the bug Something isn't working label Sep 23, 2024
@timtebeek timtebeek self-assigned this Sep 23, 2024
@timtebeek timtebeek merged commit 2f24d50 into main Sep 24, 2024
2 checks passed
@timtebeek timtebeek deleted the only-bump-plugin-version-property-when-needed branch September 24, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant