assert app.isFile() : "${app} file is missing or not a file."
-def buildLog = new File(basedir, "build.log")
-def content = FileUtils.fileRead(buildLog, "UTF-8")
+def buildLog = new File(basedirTargetProject, "build.log").text
-assert content.contains("Archetype tests executed!") :
+assert buildLog.contains("Archetype tests executed!") :
"build.log missing System.out.println from verify.groovy"
// we expect the archetype:integration-test to use the settings.xml from the main Maven build - so downloading should happen
// also from local.central specified in the test-settings.xml
-assert content.contains("local.central (file://") :
+assert buildLog.contains("local.central (file://") :
"test-settings.xml wasn't passed from the main Maven build!: 'local.central (file://' was NOT found in the output! The output was:\n${content}"
def settingsXmlPath = new File("maven-archetype-plugin/target/it/projects/ARCHETYPE-622_main_build_settings/target/archetype-it", "archetype-settings.xml").toPath().toString().replace("\\", "\\\\")
-assert content.matches("(?s).*\\[DEBUG\\] Reading user settings from .*" + settingsXmlPath + ".*") : "test-settings.xml wasn't passed from the main Maven build!: 'Reading user settings from ... archetype-settings.xml' was NOT found in the output! The output was:\n${content}"
+assert buildLog.matches("(?s).*\\[DEBUG\\] Reading user settings from .*" + settingsXmlPath + ".*") : "test-settings.xml wasn't passed from the main Maven build!: 'Reading user settings from ... archetype-settings.xml' was NOT found in the output! The output was: ${buildLog}"
+
+def mainBuildLog = new File( basedir, "../../logs/ARCHETYPE-622_main_build_settings/build.log" ).text
+assert mainBuildLog.contains('[INFO] Invoking post-archetype-generation goals: compile') : 'post-archetype-generation invocation not recorder in log'
+assert !mainBuildLog.contains('[INFO] [INFO]') : 'output of post-archetype-generation should not be present in log'
\ No newline at end of file
diff --git a/maven-archetype-plugin/src/it/projects/build-and-run-its/test-settings.xml b/maven-archetype-plugin/src/it/projects/build-and-run-its/test-settings.xml
index ab9e16e4..cb295a6b 100644
--- a/maven-archetype-plugin/src/it/projects/build-and-run-its/test-settings.xml
+++ b/maven-archetype-plugin/src/it/projects/build-and-run-its/test-settings.xml
@@ -32,9 +32,11 @@ under the License.
@localRepositoryUrl@
true
+ ignore
true
+ ignore
@@ -44,9 +46,11 @@ under the License.
@localRepositoryUrl@
true
+ ignore
true
+ ignore
diff --git a/maven-archetype-plugin/src/it/projects/build-archetype/test-settings.xml b/maven-archetype-plugin/src/it/projects/build-archetype/test-settings.xml
index ab9e16e4..cb295a6b 100644
--- a/maven-archetype-plugin/src/it/projects/build-archetype/test-settings.xml
+++ b/maven-archetype-plugin/src/it/projects/build-archetype/test-settings.xml
@@ -32,9 +32,11 @@ under the License.
@localRepositoryUrl@
true
+ ignore
true
+ ignore
@@ -44,9 +46,11 @@ under the License.
@localRepositoryUrl@
true
+ ignore
true
+ ignore
diff --git a/maven-archetype-plugin/src/it/projects/build-ignore-eol/test-settings.xml b/maven-archetype-plugin/src/it/projects/build-ignore-eol/test-settings.xml
index ab9e16e4..cb295a6b 100644
--- a/maven-archetype-plugin/src/it/projects/build-ignore-eol/test-settings.xml
+++ b/maven-archetype-plugin/src/it/projects/build-ignore-eol/test-settings.xml
@@ -32,9 +32,11 @@ under the License.
@localRepositoryUrl@
true
+ ignore
true
+ ignore
@@ -44,9 +46,11 @@ under the License.
@localRepositoryUrl@
true
+ ignore
true
+ ignore
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/FileLogger.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/FileLogger.java
index 18332eff..a02ec3e0 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/FileLogger.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/FileLogger.java
@@ -40,18 +40,14 @@
import java.io.File;
import java.io.IOException;
+import org.apache.maven.plugin.logging.Log;
import org.apache.maven.shared.invoker.InvocationOutputHandler;
-import org.apache.maven.shared.scriptinterpreter.ExecutionLogger;
-import org.apache.maven.shared.scriptinterpreter.FileLoggerMirrorHandler;
-import org.slf4j.Logger;
/**
* @since 2.2
*/
-class FileLogger extends org.apache.maven.shared.scriptinterpreter.FileLogger
- implements InvocationOutputHandler, ExecutionLogger, FileLoggerMirrorHandler {
+class FileLogger extends org.apache.maven.shared.scriptinterpreter.FileLogger implements InvocationOutputHandler {
- Logger logger;
/**
* Creates a new logger that writes to the specified file.
*
@@ -69,13 +65,7 @@ class FileLogger extends org.apache.maven.shared.scriptinterpreter.FileLogger
* @param log The mojo logger to additionally output messages to, may be null
if not used.
* @throws java.io.IOException If the output file could not be created.
*/
- FileLogger(File outputFile, Logger log) throws IOException {
- super(outputFile);
- logger = log;
- }
-
- @Override
- public void consumeOutput(String message) {
- logger.info(message);
+ FileLogger(File outputFile, Log log) throws IOException {
+ super(outputFile, log::info);
}
}
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
index 4543ed4c..8b2de572 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
@@ -69,7 +69,6 @@
import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
import org.codehaus.plexus.util.xml.XmlStreamReader;
import org.codehaus.plexus.util.xml.XmlStreamWriter;
-import org.slf4j.LoggerFactory;
/**
* Execute the archetype integration tests, consisting in generating projects from the current archetype and optionally
@@ -588,7 +587,6 @@ private void invokePostArchetypeGenerationGoals(String goals, File basedir, File
if (logger != null) {
request.setErrorHandler(logger);
-
request.setOutputHandler(logger);
}
@@ -659,7 +657,7 @@ private FileLogger setupLogger(File basedir) throws IOException {
File outputLog = new File(basedir, "build.log");
if (streamLogs) {
- logger = new FileLogger(outputLog, LoggerFactory.getLogger(getClass()));
+ logger = new FileLogger(outputLog, getLog());
} else {
logger = new FileLogger(outputLog);
}