-
Notifications
You must be signed in to change notification settings - Fork 354
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
UpdateMavenWrapper is reported as changing a lot of files (but it does not) #3948
Comments
So this is likely because the LST is being built by Maven and you're running the I'll let another person weight in as well on if we should be updating that marker or if we should stop updating it, but that's going to be the cause. |
Sharing some very quick insights on what I think factors in, and what we might need to change instead (in between calls). When we update the Maven wrapper, one of the things we do is change the BuildTool marker on source files to say they (now) use the newer Maven version. I think what you're seeing is an update to this marker reported as a code change, even though it's not printed to the output. The rewrite/rewrite-maven/src/main/java/org/openrewrite/maven/UpdateMavenWrapper.java Lines 189 to 190 in 73313f6
What I think could be improved is that we now unconditionally add that marker to all source files in the Maven plugin, whereas we could be more selective to only add that to Maven associated files like any I don't yet know why that would suddenly pop up now, which makes me not entirely sure this exactly what's going on, but it would be me first attempt at fixing this. Alternatively we can look at not reporting changes to files in the plugin if there's no printed difference; that would hide the issue in both a good and a bad way. |
As far as we are concerned, it appears now because we just included the update in our recipes. I understand what you're saying and it sounds logical, even if I definitely would prefer it not appearing for my Java files. Now, what's even more puzzling is the second item I was reporting namely:
This change seems to be randomly reported by the last recipe we apply. Would it be because this change is not affected to the |
So what is probably happening for that one is that the It seems like the recipe log might be missing recording of the fact that a recipe deleted a file, so that it can output it in the log section you provided. |
As mentioned, the And it specifically changes an Apache Camel class so I doubt it would apply any changes to the deleted file:
It's a wild guess but I wouldn't be surprised if you were affecting the change to the last recipe around if not affected at all :). |
BTW, sorry for not providing the recipe file but it's 4k lines long so trying to push you the relevant info instead :) |
Hmm, true. That is interesting. |
Just as a curious experiment, have you tried changing what would be the last recipe executed to see if it follows that one? It definitely sounds like a bug somewhere though. |
I can confirm it's always the last recipe applied that is reported as making this change. |
Wrestled a bit with similar change in the Gradle plugin this week; I think this will resolve the over reported marker changes: |
Looking at it some more I can say the problem is at least not obvious/expected. We already have some handling in the plugin to not report results when there are no visible changes; I'd have expected that to not produce these lines if there's indeed no code change to go along with it. 🤔 And we've since revised how we do marker updates for Java upgrades, which we could learn from for this problem here. |
What version of OpenRewrite are you using?
I am using
I checked if the
UpdateMavenWrapper
had recent changes but I don't see any.How are you running OpenRewrite?
Using Quarkus CLI and OpenRewrite Maven Plugin.
What is the smallest, simplest way to reproduce the problem?
Not exactly sure yet as our recipes are pretty intricate.
I was wondering if the issue was something obvious/expected. If not, I will take the time to dig more into it and prepare a reproducer.
What I currently know is that:
is applied first and then our usual recipes.
As long as
org.openrewrite.maven.UpdateMavenWrapper
is declared, the change report is very suspicious so I suspect this recipe is doing something odd.Or that it interacts with some other recipes we have.
What did you expect to see?
I don't expect
org.openrewrite.maven.UpdateMavenWrapper
to be reported as applying changes to all the files.What did you see instead?
The
org.openrewrite.maven.UpdateMavenWrapper
is reported for each file modified as in:Also, the recipe applying changes to one of the wrapper file is the last one of the recipes we apply and not
UpdateMavenWrapper
(yes I know, this is very odd):The text was updated successfully, but these errors were encountered: