diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/Client.java b/client/src/main/java/org/jboss/fuse/mvnd/client/Client.java
index 270e21f7..a39eb7da 100644
--- a/client/src/main/java/org/jboss/fuse/mvnd/client/Client.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/Client.java
@@ -17,6 +17,7 @@ package org.jboss.fuse.mvnd.client;
import java.util.Arrays;
import java.util.List;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
public interface Client {
diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java
index bb829ee7..8e26ab53 100644
--- a/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java
@@ -35,6 +35,8 @@ import org.jboss.fuse.mvnd.common.Message.BuildEvent;
import org.jboss.fuse.mvnd.common.Message.BuildException;
import org.jboss.fuse.mvnd.common.Message.BuildMessage;
import org.jboss.fuse.mvnd.common.Message.MessageSerializer;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
+import org.jboss.fuse.mvnd.common.logging.TerminalOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/ClientOutput.java b/common/src/main/java/org/jboss/fuse/mvnd/common/logging/ClientOutput.java
similarity index 95%
rename from client/src/main/java/org/jboss/fuse/mvnd/client/ClientOutput.java
rename to common/src/main/java/org/jboss/fuse/mvnd/common/logging/ClientOutput.java
index 9f797a8b..e8f7e7ee 100644
--- a/client/src/main/java/org/jboss/fuse/mvnd/client/ClientOutput.java
+++ b/common/src/main/java/org/jboss/fuse/mvnd/common/logging/ClientOutput.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.client;
+package org.jboss.fuse.mvnd.common.logging;
/**
* A sink for various kinds of events sent by the daemon.
diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/TerminalOutput.java b/common/src/main/java/org/jboss/fuse/mvnd/common/logging/TerminalOutput.java
similarity index 99%
rename from client/src/main/java/org/jboss/fuse/mvnd/client/TerminalOutput.java
rename to common/src/main/java/org/jboss/fuse/mvnd/common/logging/TerminalOutput.java
index 0b89c550..28c78690 100644
--- a/client/src/main/java/org/jboss/fuse/mvnd/client/TerminalOutput.java
+++ b/common/src/main/java/org/jboss/fuse/mvnd/common/logging/TerminalOutput.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.client;
+package org.jboss.fuse.mvnd.common.logging;
import java.io.IOException;
import java.io.InterruptedIOException;
diff --git a/daemon/src/main/distro/bin/m2.conf b/daemon/src/main/distro/bin/m2.conf
new file mode 100644
index 00000000..bf4fec84
--- /dev/null
+++ b/daemon/src/main/distro/bin/m2.conf
@@ -0,0 +1,24 @@
+# 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.
+main is org.apache.maven.cli.MavenCli from plexus.core
+
+set maven.conf default ${maven.home}/conf
+
+[plexus.core]
+load ${maven.conf}/logging
+optionally ${maven.home}/lib/ext/*.jar
+load ${maven.home}/lib/*.jar
diff --git a/daemon/src/main/distro/bin/mvn b/daemon/src/main/distro/bin/mvn
new file mode 100755
index 00000000..e149b765
--- /dev/null
+++ b/daemon/src/main/distro/bin/mvn
@@ -0,0 +1,201 @@
+#!/bin/sh
+
+# 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.
+
+# -----------------------------------------------------------------------------
+# Apache Maven Startup Script
+#
+# Environment Variable Prerequisites
+#
+# JAVA_HOME Must point at your Java Development Kit installation.
+# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+# -----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+mingw=false;
+case "`uname`" in
+ CYGWIN*) cygwin=true;;
+ MINGW*) mingw=true;;
+esac
+
+## resolve links - $0 may be a link to Maven's home
+PRG="$0"
+
+# need this for relative symlinks
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+done
+
+saveddir=`pwd`
+
+MAVEN_HOME=`dirname "$PRG"`/..
+
+# make it fully qualified
+MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
+
+cd "$saveddir"
+
+# For Cygwin, ensure paths are in Unix format before anything is touched
+if $cygwin ; then
+ [ -n "$MAVEN_HOME" ] &&
+ MAVEN_HOME=`cygpath --unix "$MAVEN_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For MinGW, ensure paths are in Unix format before anything is touched
+if $mingw ; then
+ [ -n "$MAVEN_HOME" ] &&
+ MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
+ # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ JAVACMD=`which java`
+else
+ JAVACMD="$JAVA_HOME/bin/java"
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "The JAVA_HOME environment variable is not defined correctly" >&2
+ echo "This environment variable is needed to run this program" >&2
+ echo "NB: JAVA_HOME should point to a JDK not a JRE" >&2
+ exit 1
+fi
+
+CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ [ -n "$MAVEN_HOME" ] &&
+ MAVEN_HOME=`cygpath --path --windows "$MAVEN_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$CLASSWORLDS_JAR" ] &&
+ CLASSWORLDS_JAR=`cygpath --path --windows "$CLASSWORLDS_JAR"`
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+(
+ basedir=`find_file_argument_basedir "$@"`
+ wdir="${basedir}"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ wdir=`cd "$wdir/.."; pwd`
+ done
+ echo "${basedir}"
+)
+}
+
+find_file_argument_basedir() {
+(
+ basedir=`pwd`
+
+ found_file_switch=0
+ for arg in "$@"; do
+ if [ ${found_file_switch} -eq 1 ]; then
+ if [ -d "${arg}" ]; then
+ basedir=`cd "${arg}" && pwd -P`
+ elif [ -f "${arg}" ]; then
+ basedir=`dirname "${arg}"`
+ basedir=`cd "${basedir}" && pwd -P`
+ if [ ! -d "${basedir}" ]; then
+ echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
+ exit 1
+ fi
+ else
+ echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
+ exit 1
+ fi
+ break
+ fi
+ if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
+ found_file_switch=1
+ fi
+ done
+ echo "${basedir}"
+)
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "`tr -s '\r\n' ' ' < "$1"`"
+ fi
+}
+
+MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
+MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
+
+# For Cygwin, switch project base directory path to Windows format before
+# executing Maven otherwise this will cause Maven not to consider it.
+if $cygwin ; then
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+export MAVEN_PROJECTBASEDIR
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "${CLASSWORLDS_JAR}" \
+ "-Dlogback.configurationFile=${MAVEN_HOME}/conf/logging/logback-mvn.xml" \
+ "-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \
+ "-Dmvnd.home=${MAVEN_HOME}" \
+ "-Dmaven.home=${MAVEN_HOME}" \
+ "-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${CLASSWORLDS_LAUNCHER} "$@"
diff --git a/daemon/src/main/distro/bin/mvns b/daemon/src/main/distro/bin/mvns
index 6830f126..7b38bbc9 100755
--- a/daemon/src/main/distro/bin/mvns
+++ b/daemon/src/main/distro/bin/mvns
@@ -17,5 +17,187 @@
# specific language governing permissions and limitations
# under the License.
-"`dirname "$0"`/mvn" --builder smart --threads 8 --define buildtime.output.log --define maven.logging=smart "$@"
+# -----------------------------------------------------------------------------
+# Apache Maven Startup Script
+#
+# Environment Variable Prerequisites
+#
+# JAVA_HOME Must point at your Java Development Kit installation.
+# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+# -----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+mingw=false;
+case "`uname`" in
+ CYGWIN*) cygwin=true;;
+ MINGW*) mingw=true;;
+esac
+
+## resolve links - $0 may be a link to Maven's home
+PRG="$0"
+
+# need this for relative symlinks
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+done
+
+saveddir=`pwd`
+
+MAVEN_HOME=`dirname "$PRG"`/..
+
+# make it fully qualified
+MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
+
+cd "$saveddir"
+
+# For Cygwin, ensure paths are in Unix format before anything is touched
+if $cygwin ; then
+ [ -n "$MAVEN_HOME" ] &&
+ MAVEN_HOME=`cygpath --unix "$MAVEN_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For MinGW, ensure paths are in Unix format before anything is touched
+if $mingw ; then
+ [ -n "$MAVEN_HOME" ] &&
+ MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
+ # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ JAVACMD=`which java`
+else
+ JAVACMD="$JAVA_HOME/bin/java"
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "The JAVA_HOME environment variable is not defined correctly" >&2
+ echo "This environment variable is needed to run this program" >&2
+ echo "NB: JAVA_HOME should point to a JDK not a JRE" >&2
+ exit 1
+fi
+
+CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ [ -n "$MAVEN_HOME" ] &&
+ MAVEN_HOME=`cygpath --path --windows "$MAVEN_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$CLASSWORLDS_JAR" ] &&
+ CLASSWORLDS_JAR=`cygpath --path --windows "$CLASSWORLDS_JAR"`
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+(
+ basedir=`find_file_argument_basedir "$@"`
+ wdir="${basedir}"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ wdir=`cd "$wdir/.."; pwd`
+ done
+ echo "${basedir}"
+)
+}
+
+find_file_argument_basedir() {
+(
+ basedir=`pwd`
+
+ found_file_switch=0
+ for arg in "$@"; do
+ if [ ${found_file_switch} -eq 1 ]; then
+ if [ -d "${arg}" ]; then
+ basedir=`cd "${arg}" && pwd -P`
+ elif [ -f "${arg}" ]; then
+ basedir=`dirname "${arg}"`
+ basedir=`cd "${basedir}" && pwd -P`
+ if [ ! -d "${basedir}" ]; then
+ echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
+ exit 1
+ fi
+ else
+ echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
+ exit 1
+ fi
+ break
+ fi
+ if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
+ found_file_switch=1
+ fi
+ done
+ echo "${basedir}"
+)
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "`tr -s '\r\n' ' ' < "$1"`"
+ fi
+}
+
+MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
+MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
+
+# For Cygwin, switch project base directory path to Windows format before
+# executing Maven otherwise this will cause Maven not to consider it.
+if $cygwin ; then
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+export MAVEN_PROJECTBASEDIR
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "${CLASSWORLDS_JAR}" \
+ "-Dlogback.configurationFile=${MAVEN_HOME}/conf/logging/logback.xml" \
+ -Dmvnd.logging=mvns \
+ "-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \
+ "-Dmvnd.home=${MAVEN_HOME}" \
+ "-Dmaven.home=${MAVEN_HOME}" \
+ "-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${CLASSWORLDS_LAUNCHER} --builder smart --threads 0.5C "$@"
diff --git a/daemon/src/main/distro/conf/logging/logback-mvn.xml b/daemon/src/main/distro/conf/logging/logback-mvn.xml
new file mode 100644
index 00000000..3d344993
--- /dev/null
+++ b/daemon/src/main/distro/conf/logging/logback-mvn.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/daemon/src/main/java/org/apache/maven/cli/logging/SimpleAppender.java b/daemon/src/main/java/org/apache/maven/cli/logging/SimpleAppender.java
new file mode 100644
index 00000000..6ef1981d
--- /dev/null
+++ b/daemon/src/main/java/org/apache/maven/cli/logging/SimpleAppender.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2020 the original author or authors.
+ *
+ * Licensed 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 org.apache.maven.cli.logging;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.pattern.ThrowableProxyConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.IThrowableProxy;
+import ch.qos.logback.core.AppenderBase;
+import ch.qos.logback.core.CoreConstants;
+
+import static org.apache.maven.shared.utils.logging.MessageUtils.level;
+
+public class SimpleAppender extends AppenderBase {
+
+ @Override
+ protected void append(ILoggingEvent eventObject) {
+ StringBuilder buf = new StringBuilder();
+ buf.append('[');
+ buf.append(renderLevel(eventObject.getLevel()));
+ buf.append(']');
+ buf.append(' ');
+ buf.append(eventObject.getFormattedMessage());
+ buf.append(CoreConstants.LINE_SEPARATOR);
+ IThrowableProxy tp = eventObject.getThrowableProxy();
+ if (tp != null) {
+ buf.append(CoreConstants.LINE_SEPARATOR);
+ buf.append(new ThrowableProxyConverter().convert(eventObject));
+ }
+ System.out.print(buf.toString());
+ }
+
+ private String renderLevel(Level level) {
+ switch (level.toInt()) {
+ case Level.TRACE_INT:
+ return level().debug("TRACE");
+ case Level.DEBUG_INT:
+ return level().debug("DEBUG");
+ case Level.INFO_INT:
+ return level().info("INFO");
+ case Level.WARN_INT:
+ return level().warning("WARNING");
+ case Level.ERROR_INT:
+ return level().error("ERROR");
+ default:
+ throw new IllegalStateException("Level " + level + " is unknown.");
+ }
+
+ }
+
+}
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/logging/internal/MvndSlf4jConfiguration.java b/daemon/src/main/java/org/jboss/fuse/mvnd/logging/internal/MvndSlf4jConfiguration.java
new file mode 100644
index 00000000..34a6b202
--- /dev/null
+++ b/daemon/src/main/java/org/jboss/fuse/mvnd/logging/internal/MvndSlf4jConfiguration.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2020 the original author or authors.
+ *
+ * Licensed 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 org.jboss.fuse.mvnd.logging.internal;
+
+import org.apache.maven.cli.logging.Slf4jConfiguration;
+
+public class MvndSlf4jConfiguration implements Slf4jConfiguration {
+ @Override
+ public void setRootLoggerLevel(Level level) {
+ }
+
+ @Override
+ public void activate() {
+ }
+}
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/AbstractLoggingSpy.java b/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/AbstractLoggingSpy.java
index 97b6ae4e..c87c0972 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/AbstractLoggingSpy.java
+++ b/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/AbstractLoggingSpy.java
@@ -34,7 +34,12 @@ public abstract class AbstractLoggingSpy extends AbstractEventSpy {
public static AbstractLoggingSpy instance() {
if (instance == null) {
- instance = new MavenLoggingSpy();
+ if ("mvns".equals(System.getProperty("mvnd.logging", "mvn"))) {
+ instance = new MavenLoggingSpy();
+ } else {
+ instance = new AbstractLoggingSpy() {
+ };
+ }
}
return instance;
}
@@ -112,32 +117,23 @@ public abstract class AbstractLoggingSpy extends AbstractEventSpy {
protected void onStartProject(String projectId, String display) {
MDC.put(KEY_PROJECT_ID, projectId);
- update();
}
protected void onStopProject(String projectId, String display) {
- MDC.put(KEY_PROJECT_ID, projectId);
- update();
MDC.remove(KEY_PROJECT_ID);
}
protected void onStartMojo(String projectId, String display) {
Slf4jLogger.setCurrentProject(projectId);
MDC.put(KEY_PROJECT_ID, projectId);
- update();
}
protected void onStopMojo(String projectId, String display) {
MDC.put(KEY_PROJECT_ID, projectId);
- update();
}
protected void onProjectLog(String projectId, String message) {
MDC.put(KEY_PROJECT_ID, projectId);
- update();
- }
-
- protected void update() {
}
private String getProjectId(ExecutionEvent event) {
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/MavenLoggingSpy.java b/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/MavenLoggingSpy.java
index 42b40ef2..de7de9f3 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/MavenLoggingSpy.java
+++ b/daemon/src/main/java/org/jboss/fuse/mvnd/logging/smart/MavenLoggingSpy.java
@@ -15,22 +15,11 @@
*/
package org.jboss.fuse.mvnd.logging.smart;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.jline.terminal.Size;
-import org.jline.terminal.Terminal;
-import org.jline.terminal.TerminalBuilder;
-import org.jline.utils.AttributedString;
-import org.jline.utils.Display;
+import org.jboss.fuse.mvnd.common.logging.TerminalOutput;
public class MavenLoggingSpy extends AbstractLoggingSpy {
- private Map projects = new LinkedHashMap<>();
- private Terminal terminal;
- private Display display;
+ private TerminalOutput output;
public MavenLoggingSpy() {
}
@@ -38,61 +27,43 @@ public class MavenLoggingSpy extends AbstractLoggingSpy {
@Override
public void init(Context context) throws Exception {
super.init(context);
- terminal = (Terminal) context.getData().get("terminal");
- if (terminal == null) {
- terminal = TerminalBuilder.terminal();
- }
- display = new Display(terminal, false);
+ output = new TerminalOutput(null);
}
@Override
public void close() throws Exception {
- display.update(Collections.emptyList(), 0);
- terminal.flush();
- terminal.close();
- terminal = null;
- display = null;
+ output.close();
super.close();
}
@Override
protected void onStartProject(String projectId, String display) {
- projects.put(projectId, display);
super.onStartProject(projectId, display);
+ output.projectStateChanged(projectId, display);
}
@Override
protected void onStopProject(String projectId, String display) {
- projects.remove(projectId);
+ output.projectFinished(projectId);
super.onStopProject(projectId, display);
}
@Override
protected void onStartMojo(String projectId, String display) {
- projects.put(projectId, display);
super.onStartMojo(projectId, display);
+ output.projectStateChanged(projectId, display);
}
@Override
protected void onStopMojo(String projectId, String display) {
- projects.put(projectId, display);
+ output.projectStateChanged(projectId, ":" + projectId);
super.onStopMojo(projectId, display);
}
@Override
protected void onProjectLog(String projectId, String message) {
super.onProjectLog(projectId, message);
- }
-
- protected void update() {
- Size size = terminal.getSize();
- display.resize(size.getRows(), size.getColumns());
- List lines = new ArrayList<>();
- lines.add(new AttributedString("Building..."));
- for (String build : projects.values()) {
- lines.add(new AttributedString(build));
- }
- display.update(lines, -1);
+ output.accept(projectId, message);
}
}
diff --git a/daemon/src/main/resources/META-INF/maven/slf4j-configuration.properties b/daemon/src/main/resources/META-INF/maven/slf4j-configuration.properties
index 7ae17c04..962ae43e 100644
--- a/daemon/src/main/resources/META-INF/maven/slf4j-configuration.properties
+++ b/daemon/src/main/resources/META-INF/maven/slf4j-configuration.properties
@@ -16,4 +16,4 @@
# key = Slf4j effective logger factory implementation
# value = corresponding o.a.m.cli.logging.Slf4jConfiguration class
-ch.qos.logback.classic.LoggerContext org.jboss.fuse.mvnd.logging.logback.internal.InadequateSlf4jConfiguration
+ch.qos.logback.classic.LoggerContext org.jboss.fuse.mvnd.logging.internal.MvndSlf4jConfiguration
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java
index 687fc173..0fc82787 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java
@@ -24,7 +24,7 @@ import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.client.Client;
import org.jboss.fuse.mvnd.client.ClientLayout;
-import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
import org.jboss.fuse.mvnd.junit.MvndNativeTest;
import org.jboss.fuse.mvnd.junit.TestUtils;
import org.junit.jupiter.api.Test;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java
index c41f2db1..6a78eec9 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java
@@ -25,7 +25,7 @@ import org.jboss.fuse.mvnd.assertj.EqualsInOrderAmongOthers;
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
import org.jboss.fuse.mvnd.client.Client;
import org.jboss.fuse.mvnd.client.ClientLayout;
-import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
import org.jboss.fuse.mvnd.junit.MvndTest;
import org.jboss.fuse.mvnd.junit.TestUtils;
import org.junit.jupiter.api.Test;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleNativeIT.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleNativeIT.java
index c0f7f89b..b19e6c86 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleNativeIT.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleNativeIT.java
@@ -23,7 +23,7 @@ import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.client.Client;
import org.jboss.fuse.mvnd.client.ClientLayout;
-import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
import org.jboss.fuse.mvnd.junit.MvndNativeTest;
import org.jboss.fuse.mvnd.junit.TestUtils;
import org.junit.jupiter.api.Test;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java
index fcfc69ec..d829d6bf 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java
@@ -16,7 +16,7 @@
package org.jboss.fuse.mvnd.it;
import java.util.Properties;
-import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
import org.jboss.fuse.mvnd.junit.MvndTest;
import org.mockito.InOrder;
import org.mockito.Mockito;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java
index 8cd43073..a61f0125 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java
@@ -21,8 +21,8 @@ import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
import org.jboss.fuse.mvnd.client.Client;
-import org.jboss.fuse.mvnd.client.ClientOutput;
import org.jboss.fuse.mvnd.common.DaemonInfo;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
import org.jboss.fuse.mvnd.junit.MvndTest;
import org.jboss.fuse.mvnd.junit.TestRegistry;
import org.junit.jupiter.api.Test;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/UpgradesInBomNativeIT.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/UpgradesInBomNativeIT.java
index 73ebb0e0..85bd51c7 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/UpgradesInBomNativeIT.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/UpgradesInBomNativeIT.java
@@ -21,8 +21,8 @@ import java.util.Arrays;
import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.client.Client;
-import org.jboss.fuse.mvnd.client.ClientOutput;
import org.jboss.fuse.mvnd.common.DaemonInfo;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
import org.jboss.fuse.mvnd.junit.ClientFactory;
import org.jboss.fuse.mvnd.junit.MvndNativeTest;
import org.jboss.fuse.mvnd.junit.TestLayout;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionNativeIT.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionNativeIT.java
index 92aef608..120d5d66 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionNativeIT.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionNativeIT.java
@@ -21,7 +21,7 @@ import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
import org.jboss.fuse.mvnd.client.Client;
import org.jboss.fuse.mvnd.client.ClientLayout;
-import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
import org.jboss.fuse.mvnd.junit.MvndNativeTest;
import org.jboss.fuse.mvnd.junit.MvndTestExtension;
import org.junit.jupiter.api.Test;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/NativeTestClient.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/NativeTestClient.java
index f20aa564..72abdee7 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/NativeTestClient.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/NativeTestClient.java
@@ -28,9 +28,9 @@ import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import org.jboss.fuse.mvnd.client.Client;
import org.jboss.fuse.mvnd.client.ClientLayout;
-import org.jboss.fuse.mvnd.client.ClientOutput;
import org.jboss.fuse.mvnd.client.ExecutionResult;
import org.jboss.fuse.mvnd.common.Environment;
+import org.jboss.fuse.mvnd.common.logging.ClientOutput;
/**
* A wrapper around the native executable.
diff --git a/pom.xml b/pom.xml
index b32723de..7ecbbb5c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -235,12 +235,14 @@ limitations under the License.
**/README.*
**/.gitkeep
**/conf/logging/logback.xml
+ **/mvnd.properties.template
+ **/m2.conf
+ **/mvnd
.gitattributes/
.mvn/maven.config
.mvn/wrapper/
LICENSE.txt
NOTICE.txt
- **/mvnd.properties.template
mvnw
mvnw.cmd
pom.xml.versionsBackup
@@ -248,7 +250,8 @@ limitations under the License.
SLASHSTAR_STYLE
SLASHSTAR_STYLE
- SCRIPT_STYLE
+ SCRIPT_STYLE
+ SCRIPT_STYLE
SCRIPT_STYLE
APOSTROPHE_STYLE