diff --git a/src/main/java/org/jenkins/tools/test/PluginCompatTester.java b/src/main/java/org/jenkins/tools/test/PluginCompatTester.java index 7abc972b6..086208b4a 100644 --- a/src/main/java/org/jenkins/tools/test/PluginCompatTester.java +++ b/src/main/java/org/jenkins/tools/test/PluginCompatTester.java @@ -688,9 +688,9 @@ public static String getMavenModule(String plugin, File pluginPath, MavenRunner } File log = new File(parentFile.getAbsolutePath() + File.separatorChar + "modules.log"); runner.run( - Map.of("expression", "project.modules", "forceStdout", "true"), + Map.of("expression", "project.modules", "output", log.getAbsolutePath()), parentFile, - log, + null, "-q", "help:evaluate"); List lines; diff --git a/src/main/java/org/jenkins/tools/test/hook/MultiParentCompileHook.java b/src/main/java/org/jenkins/tools/test/hook/MultiParentCompileHook.java index 46c89c7e5..ff1f259ce 100644 --- a/src/main/java/org/jenkins/tools/test/hook/MultiParentCompileHook.java +++ b/src/main/java/org/jenkins/tools/test/hook/MultiParentCompileHook.java @@ -191,9 +191,9 @@ private boolean isSnapshotMultiParentPlugin( File log = new File(parentFile.getAbsolutePath() + File.separatorChar + "version.log"); runner.run( - Map.of("expression", "project.version", "forceStdout", "true"), + Map.of("expression", "project.version", "output", log.getAbsolutePath()), parentFile, - log, + null, "-q", "help:evaluate"); List output; diff --git a/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java b/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java index 28dab166b..6c12b8601 100644 --- a/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java +++ b/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java @@ -2,6 +2,7 @@ import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.BufferedReader; import java.io.File; @@ -107,9 +108,9 @@ private static class MavenGobbler extends Thread { @NonNull private final Process p; - @NonNull private final File buildLogFile; + @CheckForNull private final File buildLogFile; - public MavenGobbler(@NonNull Process p, @NonNull File buildLogFile) { + public MavenGobbler(@NonNull Process p, @Nullable File buildLogFile) { this.p = p; this.buildLogFile = buildLogFile; } @@ -119,7 +120,10 @@ public void run() { try (InputStream is = p.getInputStream(); Reader isr = new InputStreamReader(is, Charset.defaultCharset()); BufferedReader r = new BufferedReader(isr); - OutputStream os = new FileOutputStream(buildLogFile, true); + OutputStream os = + buildLogFile == null + ? OutputStream.nullOutputStream() + : new FileOutputStream(buildLogFile, true); Writer osw = new OutputStreamWriter(os, Charset.defaultCharset()); PrintWriter w = new PrintWriter(osw)) { String line;