Skip to content

Commit

Permalink
Move back mvn script into the mvn/bin folder to avoid conflicts, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Mar 10, 2023
1 parent c2e4ee2 commit d771375
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ private Process startDaemonProcess(String daemonId, ClientOutput output) {
// 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")) {
Expand All @@ -356,7 +356,8 @@ private Process startDaemonProcess(String daemonId, ClientOutput output) {
}
}
}
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")) {
Expand All @@ -367,7 +368,7 @@ private Process startDaemonProcess(String daemonId, ClientOutput output) {
}
}
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/");
Expand Down Expand Up @@ -428,8 +429,8 @@ private Process startDaemonProcess(String daemonId, ClientOutput output) {
}

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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ private String mvndHomeFromExecutable() {
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();
}
}
Expand Down Expand Up @@ -239,8 +242,9 @@ public Path multiModuleProjectDirectory(Path projectDir) {

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();
}
Expand Down
6 changes: 3 additions & 3 deletions dist-m39/src/main/provisio/maven-distro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions dist-m40/src/main/provisio/maven-distro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion dist/src/main/distro/bin/mvnd-server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dist/src/main/distro/bin/mvnd.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
2 changes: 1 addition & 1 deletion dist/src/main/distro/bin/mvnd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} "$@"
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void version() throws IOException, InterruptedException {
"-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);
}
Expand Down

0 comments on commit d771375

Please sign in to comment.