Skip to content

Commit

Permalink
adjusted MavenMojoProjectParser#logParseErrors to also log poms which…
Browse files Browse the repository at this point in the history
… were parsed correctly but encountered an error in resolution (#833)
  • Loading branch information
nmck257 authored Aug 9, 2024
1 parent 24e0765 commit 11f7942
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,18 @@ private static Optional<Charset> getCharset(MavenProject mavenProject) {
}

private SourceFile logParseErrors(SourceFile source) {
if (source instanceof ParseError) {
source.getMarkers().findFirst(ParseExceptionResult.class).ifPresent(e -> {
if (firstWarningLogged.compareAndSet(false, true)) {
logger.warn("There were problems parsing some source files" +
(mavenSession.getRequest().isShowErrors() ? "" : ", run with --errors to see full stack traces"));
}
logger.warn("There were problems parsing " + source.getSourcePath());
String pomMessage = source instanceof Xml.Document
? "; the pom could not be resolved. Some recipes may not function correctly" : "";
logger.warn("There were problems parsing " + source.getSourcePath() + pomMessage);
if (mavenSession.getRequest().isShowErrors()) {
source.getMarkers().findFirst(ParseExceptionResult.class).map(ParseExceptionResult::getMessage).ifPresent(logger::warn);
logger.warn(e.getMessage());
}
}
});
return source;
}

Expand Down

0 comments on commit 11f7942

Please sign in to comment.