Skip to content

Commit 8192852

Browse files
authored
Merge pull request #1 from jaredstehler/debug-javac-output
Log all compiler output at debug level
2 parents 609a660 + 2ef5eee commit 8192852

File tree

1 file changed

+9
-1
lines changed
  • plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac

1 file changed

+9
-1
lines changed

plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ protected CompilerResult compileOutOfProcess(CompilerConfiguration config, Strin
545545
try {
546546
returnCode = CommandLineUtils.executeCommandLine(cli, out, out);
547547

548+
if (getLog().isDebugEnabled()) {
549+
getLog().debug("Compiler output:{}{}", EOL, out.getOutput());
550+
}
551+
548552
messages = parseModernStream(returnCode, new BufferedReader(new StringReader(out.getOutput())));
549553
} catch (CommandLineException | IOException e) {
550554
throw new CompilerException("Error while executing the external compiler.", e);
@@ -587,7 +591,7 @@ protected CompilerResult compileInProcessWithProperClassloader(Class<?> javacCla
587591
/**
588592
* Helper method for compileInProcess()
589593
*/
590-
private static CompilerResult compileInProcess0(Class<?> javacClass, String[] args) throws CompilerException {
594+
private CompilerResult compileInProcess0(Class<?> javacClass, String[] args) throws CompilerException {
591595
StringWriter out = new StringWriter();
592596

593597
Integer ok;
@@ -599,6 +603,10 @@ private static CompilerResult compileInProcess0(Class<?> javacClass, String[] ar
599603

600604
ok = (Integer) compile.invoke(null, new Object[] {args, new PrintWriter(out)});
601605

606+
if (getLog().isDebugEnabled()) {
607+
getLog().debug("Compiler output:{}{}", EOL, out.toString());
608+
}
609+
602610
messages = parseModernStream(ok, new BufferedReader(new StringReader(out.toString())));
603611
} catch (NoSuchMethodException | IOException | InvocationTargetException | IllegalAccessException e) {
604612
throw new CompilerException("Error while executing the compiler.", e);

0 commit comments

Comments
 (0)