-
Notifications
You must be signed in to change notification settings - Fork 77
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
adjusted MavenMojoProjectParser#logParseErrors to also log poms which… #833
Conversation
… were parsed correctly but encountered an error in resolution
side note, I'm thinking about a change like this in protected ExecutionContext executionContext() {
return new InMemoryExecutionContext(t -> {
if (mavenSession.getRequest().isShowErrors()) {
getLog().warn(t);
} else {
getLog().debug(t);
}
});
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice measured improvement here @nmck257 ! Appreciate how you connected the dots to spot that these were silently dropped; hope this avoids some confusion going forward.
thanks for mirroring over to gradle! @timtebeek |
I've taken a slightly different approach in this follow up, as we found that logging isn't working out great on a larger scale: Note the use of |
So the default behavior with this change will be to fail-fast the whole recipe execution (and print details) if we can't resolve pom(s)? I'm fine with that if we think that's the better choice. Re ignoring partial failures -- does that mean that the user could instruct Maven to continue with other goals if the rewrite goal fails, or, something else? |
I haven't tried it, but with And yes indeed the thinking here is that a clear failure is better than skipping along and having changes not applied effectively, with a troublesome path to debugging. |
… were parsed correctly but encountered an error in resolution
What's changed?
see subject
What's your motivation?
Anything in particular you'd like reviewers to focus on?
In this implementation, these errors will get logged in the "Parsing source files..." step instead of the "Resolving poms..." step. Logging under the "resolving pom" step might be more intuitive, but this code change is more concise, and, gives an opportunity for the exclude-directory logic to run.
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
The message produced for
ParseExceptionResult
for a maven resolution issue is the entire source of the pom, with the relevant error markup comments. This is what will get logged here if--errors
are enabled, and that's a bit bloated for log output. It might be nice to adjust that logic inrewrite-maven
to instead produce an abbreviated summary of the problematic file's problems (like howgit diff
just skips to the changed lines, with a few lines of surrounding context)Checklist