Draft: Created a test for UpgradeTransitiveDependencyVersion that demonstrates the "Gradle visitor used for a Maven project" issue #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's your motivation?
I'm learning to use OpenRewrite. My overall goal is to create tooling to resolve CVEs across many Maven Java projects.
I have been unsuccessfully trying to use "org.openrewrite.java.dependencies.UpgradeTransitiveDependencyVersion" to increase version numbers. Today I found that "org.openrewrite.maven.UpgradeTransitiveDependencyVersion" worked for my specific example but "org.openrewrite.java.dependencies.UpgradeTransitiveDependencyVersion" did nothing. I'm under the impression that the latter is the newer and more flexible recipe.
Anything in particular you'd like reviewers to focus on?
This PR contains a new test class that demonstrates the setup, expected results, and the comments show which recipes worked and which didn't. When I used a debugger to see where things went wrong it looked like the issue was that the gradle isAcceptable call on line 129 of UpgradeTransitiveDepedencyVersion evaluated to true which prevented it from running the maven visitor code on line 132.
Ability to help further
Unfortunately, I can't commit the time required to figure out how to get Gradle working and deliver a fix for this. I'm hoping that by creating this test I'm making it easy enough for some else to quickly grok this and code up a fix.
Workarounds
I plan to use the maven-specific recipe mentioned above in the meantime since that one seems to work.
Checklist
I'm not set up to work with Gradle projects so this code is just copy-pasted from where I worked on it in a fork of rewrite-recipe-starter. Hopefully it is clean enough for you to work with.