Move back mvn script into the mvn/bin folder to avoid conflicts, fixes #787 (#803)

This commit is contained in:
Guillaume Nodet
2023-03-10 12:59:04 +01:00
committed by GitHub
parent c2e4ee2f00
commit d771375870
17 changed files with 32 additions and 21 deletions

View File

@@ -345,8 +345,8 @@ public class DaemonConnector {
// classpath
String mvndAgentPath = null;
String plexusClassworldsPath = null;
try (DirectoryStream<Path> jarPaths =
Files.newDirectoryStream(mvndHome.resolve("lib").resolve("ext"))) {
try (DirectoryStream<Path> jarPaths = Files.newDirectoryStream(
mvndHome.resolve("mvn").resolve("lib").resolve("ext"))) {
for (Path jar : jarPaths) {
String s = jar.getFileName().toString();
if (s.endsWith(".jar")) {
@@ -356,7 +356,8 @@ public class DaemonConnector {
}
}
}
try (DirectoryStream<Path> jarPaths = Files.newDirectoryStream(mvndHome.resolve("boot"))) {
try (DirectoryStream<Path> jarPaths =
Files.newDirectoryStream(mvndHome.resolve("mvn").resolve("boot"))) {
for (Path jar : jarPaths) {
String s = jar.getFileName().toString();
if (s.endsWith(".jar")) {
@@ -367,7 +368,7 @@ public class DaemonConnector {
}
}
if (mvndAgentPath == null) {
throw new IllegalStateException("Could not find mvnd-agent jar in lib/ext/");
throw new IllegalStateException("Could not find mvnd-agent jar in mvn/lib/ext/");
}
if (plexusClassworldsPath == null) {
throw new IllegalStateException("Could not find plexus-classworlds jar in boot/");
@@ -428,8 +429,8 @@ public class DaemonConnector {
}
Environment.MVND_HOME.addSystemProperty(args, mvndHome.toString());
args.add("-Dmaven.home=" + mvndHome);
args.add("-Dmaven.conf=" + mvndHome.resolve("conf"));
args.add("-Dmaven.home=" + mvndHome.resolve("mvn"));
args.add("-Dmaven.conf=" + mvndHome.resolve("mvn").resolve("conf"));
args.add("-Dclassworlds.conf=" + mvndHome.resolve("bin").resolve("mvnd-server.conf"));
Environment.MVND_JAVA_HOME.addSystemProperty(

View File

@@ -124,8 +124,11 @@ public class DaemonParameters {
if (mvndH != null) {
Path mvndDaemon =
Paths.get("mvnd-daemon-" + BuildProperties.getInstance().getVersion() + ".jar");
if (Files.exists(mvndH.resolve("lib").resolve(mvndDaemon))
|| Files.exists(mvndH.resolve("lib").resolve("ext").resolve(mvndDaemon))) {
if (Files.exists(mvndH.resolve("mvn").resolve("lib").resolve(mvndDaemon))
|| Files.exists(mvndH.resolve("mvn")
.resolve("lib")
.resolve("ext")
.resolve(mvndDaemon))) {
return mvndH.toString();
}
}
@@ -239,8 +242,9 @@ public class DaemonParameters {
public Path logbackConfigurationPath() {
return property(Environment.MVND_LOGBACK)
.orDefault(() ->
mvndHome().resolve("conf/logging/logback-mvnd.xml").toString())
.orDefault(() -> mvndHome()
.resolve("mvn/conf/logging/logback-server.xml")
.toString())
.orFail()
.asPath();
}

View File

@@ -17,14 +17,14 @@
-->
<assembly>
<artifactSet to="/">
<artifactSet to="/mvn">
<artifact id="org.apache.maven:apache-maven:tar.gz:bin:${maven3.version}">
<unpack useRoot="false"
excludes="conf/logging/*,lib/maven-slf4j-provider*" />
</artifact>
</artifactSet>
<artifactSet to="/lib">
<artifactSet to="/mvn/lib">
<artifact id="ch.qos.logback:logback-classic">
<exclusion id="*:*"/>
</artifact>
@@ -33,7 +33,7 @@
</artifact>
</artifactSet>
<artifactSet to="/lib/ext">
<artifactSet to="/mvn/lib/ext">
<artifact id="io.takari.maven:takari-smart-builder:${takari-smart-builder.version}">
<exclusion id="*:*"/>
</artifact>

View File

@@ -17,14 +17,14 @@
-->
<assembly>
<artifactSet to="/">
<artifactSet to="/mvn">
<artifact id="org.apache.maven:apache-maven:tar.gz:bin:${maven4.version}">
<unpack useRoot="false"
excludes="conf/logging/*,lib/maven-slf4j-provider*,lib/plexus-utils-3.*" />
</artifact>
</artifactSet>
<artifactSet to="/lib">
<artifactSet to="/mvn/lib">
<artifact id="ch.qos.logback:logback-classic">
<exclusion id="*:*"/>
</artifact>
@@ -33,7 +33,7 @@
</artifact>
</artifactSet>
<artifactSet to="/lib/ext">
<artifactSet to="/mvn/lib/ext">
<artifact id="io.takari.maven:takari-smart-builder:${takari-smart-builder.version}">
<exclusion id="*:*"/>
</artifact>

View File

@@ -16,7 +16,7 @@
# under the License.
main is org.mvndaemon.mvnd.client.DefaultClient from plexus.core
set maven.home default ${mvnd.home}
set maven.home default ${mvnd.home}/mvn
set maven.conf default ${maven.home}/conf
set logback.configurationFile default ${maven.conf}/logging/logback-client.xml

View File

@@ -16,9 +16,12 @@
# under the License.
main is org.mvndaemon.mvnd.daemon.Server from plexus.core
set maven.home default ${mvnd.home}
set maven.home default ${mvnd.home}/mvn
set maven.conf default ${maven.home}/conf
set logback.configurationFile default ${maven.conf}/logging/logback-server.xml
set logback.configurationFile.fallback default ${maven.conf}/logging/logback.xml
[plexus.core]
load ${maven.conf}/logging
optionally ${maven.home}/lib/ext/*.jar

View File

@@ -197,7 +197,7 @@ set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %CLASSWORLDS_JAR% ^
"-Dclassworlds.conf=%MVND_HOME%\bin\mvnd.conf"
"-Dclassworlds.conf=%MVND_HOME%\bin\mvnd-client.conf" ^
"-Dmvnd.home=%MVND_HOME%" ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%

View File

@@ -219,7 +219,7 @@ exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "${CLASSWORLDS_JAR}" \
"-Dclassworlds.conf=${MVND_HOME}/bin/mvnd.conf" \
"-Dclassworlds.conf=${MVND_HOME}/bin/mvnd-client.conf" \
"-Dmvnd.home=${MVND_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${CLASSWORLDS_LAUNCHER} "$@"

View File

@@ -18,6 +18,9 @@ main is org.apache.maven.cli.MavenCli from plexus.core
set maven.conf default ${maven.home}/conf
set logback.configurationFile default ${maven.conf}/logging/logback-mvn.xml
set logback.configurationFile.fallback default ${maven.conf}/logging/logback.xml
[plexus.core]
load ${maven.conf}/logging
optionally ${maven.home}/lib/ext/*.jar

View File

@@ -52,7 +52,7 @@ public class MavenConfNativeIT {
"-DforceStdout",
"--raw-streams")
.assertSuccess();
String conf = parameters.mvndHome().resolve("conf").toString();
String conf = parameters.mvndHome().resolve("mvn").resolve("conf").toString();
assertTrue(
o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf);
}