Order of parsed Maven modules is sometimes not correct #601
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 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