-
Notifications
You must be signed in to change notification settings - Fork 75
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
Order of parsed Maven modules is sometimes not correct #601
base: main
Are you sure you want to change the base?
Conversation
I've struggled a bit locally to see if we can test this through the integration test feature, but no luck thus far. My breakpoints aren't triggered, and even log output I add isn't showing; Perhaps you'd have more luck; my branch is here. I'm exploring a bit the logic in SBM and the modules going into the Maven parser, roughly starting here: Instead we look to consistently use rewrite-maven-plugin/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java Lines 138 to 141 in 9ffe2b3
Not quite sure how that might end up with a different order as compared to your changes here. 🤔 Will continue later, unless you have any new insights given the above. |
I understand that's a tricky part. I would think the problem will be solved with 9ffe2b3. |
What's changed?
The method
MavenMojoProjectParser#collectPoms
adds the poms in the wrong order.I think the problem can be fixed by using
MavenSession#getProjects()
instead.What's your motivation?
Anything in particular you'd like reviewers to focus on?
I need some advice on how you think this should be tested.
My preferred approach would have been to test the method
collectPoms
and verify that the poms added to thepaths
exactly in the order as returned byMavenSession#getProjects()
.I would have liked to pass in a Mock for
MavenSession
and verify the call.But there are some problems with this approach:
And an additional test that verifies the expected behavior of
MavenSession#getProjects()
- the correct orderingThe next (additional) way to test this I'd see is an integration test for the plugin itself and verifying the parsing events. I did not understand
RewriteRunIT
and would be interested in your opinion of how to approach this before proceeding.Anyone you would like to review specifically?
@timtebeek
Have you considered any alternatives or workarounds?
By decoupling the
MavenMojoProject
parser fromFile
and Maven unittest would become easier.Any additional context
Checklist
./gradlew licenseFormat