diff --git a/pom.xml b/pom.xml
index cc87562d..1b60d902 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,6 +145,12 @@ under the License.
${mavenVersion}
provided
+
+ org.apache.maven.resolver
+ maven-resolver-api
+ 1.4.1
+ provided
+
org.apache.maven.resolver
maven-resolver-util
@@ -205,6 +211,16 @@ under the License.
maven-script-interpreter
1.6
+
+ org.apache.commons
+ commons-text
+ 1.12.0
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.36
+
${beanshell-groupId}
diff --git a/src/it/MINVOKER-351/invoker.properties b/src/it/MINVOKER-351/invoker.properties
new file mode 100644
index 00000000..c81e25fc
--- /dev/null
+++ b/src/it/MINVOKER-351/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals = initialize site
diff --git a/src/it/MINVOKER-351/pom.xml b/src/it/MINVOKER-351/pom.xml
new file mode 100644
index 00000000..86c6f059
--- /dev/null
+++ b/src/it/MINVOKER-351/pom.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+ 4.0.0
+
+ example.minvoker351
+ minvoker-351
+ 1.0-SNAPSHOT
+ pom
+
+
+ UTF-8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ @version.maven-site-plugin@
+
+
+ org.apache.maven.plugins
+ maven-invoker-plugin
+ @project.version@
+
+ ${project.build.directory}/it
+ ${project.build.directory}/local-repo
+ true
+
+
+
+ integration-test
+ initialize
+
+ install
+ run
+
+
+
+
+
+
+
+
+
+ true
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ @version.maven-surefire@
+
+
+ ${project.build.directory}/invoker-reports-test
+
+
+
+
+
+ report-only
+
+
+
+
+
+
+
diff --git a/src/it/MINVOKER-351/src/it/minvoker-351/pom.xml b/src/it/MINVOKER-351/src/it/minvoker-351/pom.xml
new file mode 100644
index 00000000..a0d476e6
--- /dev/null
+++ b/src/it/MINVOKER-351/src/it/minvoker-351/pom.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+ 4.0.0
+
+ example.minvoker351
+ minvoker-351
+ 1.0-SNAPSHOT
+
+
+ UTF-8
+ 8
+ 8
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ 5.10.2
+ test
+
+
+
diff --git a/src/it/MINVOKER-351/src/it/minvoker-351/src/main/java/example/minvoker351/Example.java b/src/it/MINVOKER-351/src/it/minvoker-351/src/main/java/example/minvoker351/Example.java
new file mode 100644
index 00000000..164f023e
--- /dev/null
+++ b/src/it/MINVOKER-351/src/it/minvoker-351/src/main/java/example/minvoker351/Example.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package example.minvoker351;
+
+public class Example {
+ public void printAscii() {
+ for (int i = 0; i < Byte.MAX_VALUE; ++i) {
+ System.out.println((char) i);
+ }
+ }
+}
diff --git a/src/it/MINVOKER-351/src/it/minvoker-351/src/test/java/example/minvoker351/ExampleTest.java b/src/it/MINVOKER-351/src/it/minvoker-351/src/test/java/example/minvoker351/ExampleTest.java
new file mode 100644
index 00000000..fec489d7
--- /dev/null
+++ b/src/it/MINVOKER-351/src/it/minvoker-351/src/test/java/example/minvoker351/ExampleTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package example.minvoker351;
+
+import org.junit.jupiter.api.Test;
+
+public class ExampleTest {
+ @Test
+ public void f() {
+ new Example().printAscii();
+ }
+}
diff --git a/src/it/MINVOKER-351/verify.groovy b/src/it/MINVOKER-351/verify.groovy
new file mode 100644
index 00000000..c1dbdfd8
--- /dev/null
+++ b/src/it/MINVOKER-351/verify.groovy
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def surefireReport = new File(basedir, 'target/site/surefire-report.html').text
+
+assert surefireReport.contains('maven.invoker.it.minvoker-351')
+
diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
index 5644fe2a..f6c992be 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -50,6 +50,7 @@
import java.util.TreeSet;
import java.util.stream.Collectors;
+import org.apache.commons.text.StringEscapeUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
@@ -98,6 +99,7 @@
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
import org.codehaus.plexus.util.cli.StreamConsumer;
+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XmlStreamReader;
import org.codehaus.plexus.util.xml.XmlStreamWriter;
import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -1640,7 +1642,7 @@ private void runBuild(
}
} catch (RunFailureException e) {
buildJob.setResult(e.getType());
- buildJob.setFailureMessage(e.getMessage());
+ buildJob.setFailureMessage(StringEscapeUtils.escapeXml10(e.getMessage()));
if (!suppressSummaries) {
getLog().info(" " + e.getMessage());
@@ -1779,7 +1781,7 @@ private void writeJunitReport(BuildJob buildJob, String safeFileName) throws Moj
if (buildLogFile != null && buildLogFile.exists()) {
getLog().debug("fileLogger:" + buildLogFile);
try {
- systemOut.setValue(FileUtils.fileRead(buildLogFile));
+ systemOut.setValue(StringEscapeUtils.escapeXml10(FileUtils.fileRead(buildLogFile)));
} catch (IOException e) {
throw new MojoExecutionException("Failed to read logfile " + buildLogFile, e);
}
@@ -1789,7 +1791,7 @@ private void writeJunitReport(BuildJob buildJob, String safeFileName) throws Moj
try (FileOutputStream fos = new FileOutputStream(reportFile);
Writer osw = new OutputStreamWriter(fos, buildJob.getModelEncoding())) {
- Xpp3DomWriter.write(osw, testsuite);
+ Xpp3DomWriter.write(new PrettyPrintXMLWriter(osw), testsuite, false);
} catch (IOException e) {
throw new MojoExecutionException("Failed to write JUnit build report " + reportFile, e);
}