mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-28 17:15:55 +00:00
@@ -24,12 +24,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DefaultClient {
|
||||
public static void main(String[] argv) throws Exception {
|
||||
final String logbackConfFallback = System.getProperty("logback.configurationFile.fallback");
|
||||
if (null != logbackConfFallback && !"".equals(logbackConfFallback)) {
|
||||
System.setProperty("logback.configurationFile", logbackConfFallback);
|
||||
System.clearProperty("logback.configurationFile.fallback");
|
||||
}
|
||||
|
||||
final Logger LOGGER = LoggerFactory.getLogger(DefaultClient.class);
|
||||
LOGGER.warn("Found old JDK, fallback to the embedded maven!");
|
||||
LOGGER.warn("Use JDK 11+ to run maven-mvnd client!");
|
||||
|
@@ -60,6 +60,8 @@ import org.mvndaemon.mvnd.common.logging.TerminalOutput;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.bridge.SLF4JBridgeHandler;
|
||||
import org.slf4j.impl.MvndLoggerFactory;
|
||||
import org.slf4j.impl.StaticLoggerBinder;
|
||||
|
||||
import static org.mvndaemon.mvnd.client.DaemonParameters.LOG_EXTENSION;
|
||||
|
||||
@@ -70,8 +72,6 @@ public class DefaultClient implements Client {
|
||||
private final DaemonParameters parameters;
|
||||
|
||||
public static void main(String[] argv) throws Exception {
|
||||
System.clearProperty("logback.configurationFile.fallback");
|
||||
|
||||
final List<String> args = new ArrayList<>(Arrays.asList(argv));
|
||||
|
||||
// Log file
|
||||
@@ -115,6 +115,10 @@ public class DefaultClient implements Client {
|
||||
// System properties
|
||||
setSystemPropertiesFromCommandLine(args);
|
||||
|
||||
if (StaticLoggerBinder.getSingleton().getLoggerFactory() instanceof MvndLoggerFactory) {
|
||||
((MvndLoggerFactory) StaticLoggerBinder.getSingleton().getLoggerFactory()).reconfigure();
|
||||
}
|
||||
|
||||
DaemonParameters parameters = new DaemonParameters();
|
||||
if (parameters.serial()) {
|
||||
System.setProperty(Environment.MVND_THREADS.getProperty(), Integer.toString(1));
|
||||
@@ -191,9 +195,13 @@ public class DefaultClient implements Client {
|
||||
/* This needs to be done very early, otherwise various DaemonParameters do not work properly */
|
||||
final int eqPos = val.indexOf('=');
|
||||
if (eqPos >= 0) {
|
||||
System.setProperty(val.substring(0, eqPos), val.substring(eqPos + 1));
|
||||
String k = val.substring(0, eqPos);
|
||||
String v = val.substring(eqPos + 1);
|
||||
System.setProperty(k, v);
|
||||
LOGGER.trace("Setting system property {} to {}", k, v);
|
||||
} else {
|
||||
System.setProperty(val, "");
|
||||
LOGGER.trace("Setting system property {}", val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -57,6 +57,7 @@ import org.mvndaemon.mvnd.common.SocketFamily;
|
||||
import org.mvndaemon.mvnd.common.logging.ClientOutput;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.impl.SimpleLogger;
|
||||
|
||||
import static java.lang.Thread.sleep;
|
||||
import static org.mvndaemon.mvnd.common.DaemonState.Canceled;
|
||||
@@ -433,10 +434,11 @@ public class DaemonConnector {
|
||||
args.add("-Dmaven.conf=" + mvndHome.resolve("mvn").resolve("conf"));
|
||||
args.add("-Dclassworlds.conf=" + mvndHome.resolve("bin").resolve("mvnd-daemon.conf"));
|
||||
|
||||
args.add("-D" + SimpleLogger.LOG_FILE_KEY + "="
|
||||
+ parameters.daemonStorage().resolve("daemon-" + daemonId + ".log"));
|
||||
|
||||
Environment.MVND_JAVA_HOME.addSystemProperty(
|
||||
args, parameters.javaHome().toString());
|
||||
Environment.LOGBACK_CONFIGURATION_FILE.addSystemProperty(
|
||||
args, parameters.logbackConfigurationPath().toString());
|
||||
Environment.MVND_ID.addSystemProperty(args, daemonId);
|
||||
Environment.MVND_DAEMON_STORAGE.addSystemProperty(
|
||||
args, parameters.daemonStorage().toString());
|
||||
|
@@ -184,11 +184,21 @@ public class DaemonParameters {
|
||||
}
|
||||
|
||||
public Path userDir() {
|
||||
return value(Environment.USER_DIR).orSystemProperty().orFail().asPath().toAbsolutePath();
|
||||
return value(Environment.USER_DIR)
|
||||
.orSystemProperty()
|
||||
.orFail()
|
||||
.cache(provider)
|
||||
.asPath()
|
||||
.toAbsolutePath();
|
||||
}
|
||||
|
||||
public Path userHome() {
|
||||
return value(Environment.USER_HOME).orSystemProperty().orFail().asPath().toAbsolutePath();
|
||||
return value(Environment.USER_HOME)
|
||||
.orSystemProperty()
|
||||
.orFail()
|
||||
.cache(provider)
|
||||
.asPath()
|
||||
.toAbsolutePath();
|
||||
}
|
||||
|
||||
public Path suppliedPropertiesPath() {
|
||||
@@ -256,15 +266,6 @@ public class DaemonParameters {
|
||||
.normalize();
|
||||
}
|
||||
|
||||
public Path logbackConfigurationPath() {
|
||||
return property(Environment.MVND_LOGBACK)
|
||||
.orDefault(() -> mvndHome()
|
||||
.resolve("mvn/conf/logging/logback-daemon.xml")
|
||||
.toString())
|
||||
.orFail()
|
||||
.asPath();
|
||||
}
|
||||
|
||||
public String minHeapSize() {
|
||||
return property(Environment.MVND_MIN_HEAP_SIZE).asString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user