Add property to configure JavaParser logging
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.rewrite.parsers;
|
||||
|
||||
import org.openrewrite.java.JavaParser;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.nio.file.Path;
|
||||
@@ -92,6 +93,11 @@ public class SpringRewriteProperties {
|
||||
*/
|
||||
private boolean parseAdditionalResources = true;
|
||||
|
||||
/**
|
||||
* Whether {@link JavaParser} should log compilation warnings and errors.
|
||||
*/
|
||||
private boolean logCompilationWarningsAndErrors = false;
|
||||
|
||||
public boolean isSkipMavenParsing() {
|
||||
return skipMavenParsing;
|
||||
}
|
||||
@@ -172,4 +178,12 @@ public class SpringRewriteProperties {
|
||||
this.parseAdditionalResources = parseAdditionalResources;
|
||||
}
|
||||
|
||||
public boolean isLogCompilationWarningsAndErrors() {
|
||||
return logCompilationWarningsAndErrors;
|
||||
}
|
||||
|
||||
public void setLogCompilationWarningsAndErrors(boolean logCompilationWarningsAndErrors) {
|
||||
this.logCompilationWarningsAndErrors = logCompilationWarningsAndErrors;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class MavenModuleParser {
|
||||
|
||||
JavaParser.Builder<? extends JavaParser, ?> javaParserBuilder = JavaParser.fromJavaVersion()
|
||||
.styles(styles)
|
||||
.logCompilationWarningsAndErrors(false);
|
||||
.logCompilationWarningsAndErrors(springRewriteProperties.isLogCompilationWarningsAndErrors());
|
||||
|
||||
Path buildFilePath = currentProject.getBasedir().resolve(moduleBuildFile.getSourcePath());
|
||||
LOGGER.info("Parsing module " + buildFilePath);
|
||||
|
||||
Reference in New Issue
Block a user