mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-26 05:58:27 +00:00
Honor ${maven.home}/conf/logging/logback.xml
This commit is contained in:
@@ -31,6 +31,7 @@ public class ClientLayout extends Layout {
|
||||
private final Path localMavenRepository;
|
||||
private final Path settings;
|
||||
private final Path javaHome;
|
||||
private final Path logbackConfigurationPath;
|
||||
|
||||
public static ClientLayout getEnvInstance() {
|
||||
if (ENV_INSTANCE == null) {
|
||||
@@ -45,17 +46,19 @@ public class ClientLayout extends Layout {
|
||||
Environment.findMultiModuleProjectDirectory(pwd),
|
||||
Environment.findJavaHome(mvndProperties, mvndPropertiesPath),
|
||||
findLocalRepo(),
|
||||
null);
|
||||
null,
|
||||
Environment.findLogbackConfigurationPath(mvndProperties, mvndPropertiesPath, mvndHome));
|
||||
}
|
||||
return ENV_INSTANCE;
|
||||
}
|
||||
|
||||
public ClientLayout(Path mvndPropertiesPath, Path mavenHome, Path userDir, Path multiModuleProjectDirectory, Path javaHome,
|
||||
Path localMavenRepository, Path settings) {
|
||||
Path localMavenRepository, Path settings, Path logbackConfigurationPath) {
|
||||
super(mvndPropertiesPath, mavenHome, userDir, multiModuleProjectDirectory);
|
||||
this.localMavenRepository = localMavenRepository;
|
||||
this.settings = settings;
|
||||
this.javaHome = Objects.requireNonNull(javaHome, "javaHome");
|
||||
this.logbackConfigurationPath = logbackConfigurationPath;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,19 +79,12 @@ public class ClientLayout extends Layout {
|
||||
return javaHome;
|
||||
}
|
||||
|
||||
static Path findLocalRepo() {
|
||||
return Environment.MAVEN_REPO_LOCAL.systemProperty().asPath();
|
||||
public Path getLogbackConfigurationPath() {
|
||||
return logbackConfigurationPath;
|
||||
}
|
||||
|
||||
static Path findLogbackConfigurationFile(Supplier<Properties> mvndProperties, Path mvndPropertiesPath, Path mvndHome) {
|
||||
final String rawValue = Environment.LOGBACK_CONFIGURATION_FILE
|
||||
.systemProperty()
|
||||
.orLocalProperty(mvndProperties, mvndPropertiesPath)
|
||||
.asString();
|
||||
if (rawValue != null) {
|
||||
return Paths.get(rawValue).toAbsolutePath().normalize();
|
||||
}
|
||||
return mvndHome.resolve("conf/logging/logback.xml");
|
||||
static Path findLocalRepo() {
|
||||
return Environment.MAVEN_REPO_LOCAL.systemProperty().asPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -243,7 +243,7 @@ public class DaemonConnector {
|
||||
args.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000");
|
||||
}
|
||||
args.add("-Dmaven.home=\"" + mavenHome + "\"");
|
||||
args.add("-Dlogback.configurationFile=logback.xml");
|
||||
args.add("-Dlogback.configurationFile=\""+ layout.getLogbackConfigurationPath() +"\"");
|
||||
args.add("-Ddaemon.uid=" + uid);
|
||||
args.add("-Xmx4g");
|
||||
final String timeout = Environment.DAEMON_IDLE_TIMEOUT.systemProperty().asString();
|
||||
|
@@ -132,6 +132,15 @@ public enum Environment {
|
||||
.toAbsolutePath().normalize();
|
||||
}
|
||||
|
||||
public static Path findLogbackConfigurationPath(Supplier<Properties> mvndProperties, Path mvndPropertiesPath, Path mvndHome) {
|
||||
return LOGBACK_CONFIGURATION_FILE
|
||||
.systemProperty()
|
||||
.orLocalProperty(mvndProperties, mvndPropertiesPath)
|
||||
.orDefault(() -> mvndHome.resolve("conf/logging/logback.xml").toString())
|
||||
.orFail()
|
||||
.asPath();
|
||||
}
|
||||
|
||||
public static boolean isNative() {
|
||||
return "executable".equals(System.getProperty("org.graalvm.nativeimage.kind"));
|
||||
}
|
||||
|
@@ -14,10 +14,6 @@
|
||||
<name>Maven Daemon</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.fuse.mvnd</groupId>
|
||||
<artifactId>mvnd-client</artifactId>
|
||||
|
@@ -164,7 +164,8 @@ public class MvndTestExtension implements BeforeAllCallback, BeforeEachCallback,
|
||||
testExecutionDir,
|
||||
testExecutionDir,
|
||||
Paths.get(System.getProperty("java.home")).toAbsolutePath().normalize(),
|
||||
localMavenRepository, settingsPath);
|
||||
localMavenRepository, settingsPath,
|
||||
mvndHome.resolve("conf/logging/logback.xml"));
|
||||
final DaemonRegistry registry = new DaemonRegistry(layout.registry());
|
||||
|
||||
return new MvndResource(layout, registry, isNative, timeoutMs);
|
||||
|
@@ -23,9 +23,9 @@ public class TestLayout extends ClientLayout {
|
||||
private final Path testDir;
|
||||
|
||||
public TestLayout(Path testDir, Path mvndPropertiesPath, Path mavenHome, Path userDir, Path multiModuleProjectDirectory,
|
||||
Path javaHome,
|
||||
Path localMavenRepository, Path settings) {
|
||||
super(mvndPropertiesPath, mavenHome, userDir, multiModuleProjectDirectory, javaHome, localMavenRepository, settings);
|
||||
Path javaHome, Path localMavenRepository, Path settings, Path logbackConfigurationPath) {
|
||||
super(mvndPropertiesPath, mavenHome, userDir, multiModuleProjectDirectory, javaHome, localMavenRepository,
|
||||
settings, logbackConfigurationPath);
|
||||
this.testDir = testDir;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user