mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-10 21:22:03 +00:00
Re-layout the distro so that mvn is not in bin #91
This commit is contained in:
@@ -54,7 +54,7 @@ public class ClientLayout extends Layout {
|
||||
final Path mvndH = Paths.get(cmd.get()).getParent().getParent();
|
||||
if (mvndH != null) {
|
||||
final Path mvndDaemonLib = mvndH
|
||||
.resolve("lib/ext/mvnd-daemon-" + BuildProperties.getInstance().getVersion()
|
||||
.resolve("mvn/lib/ext/mvnd-daemon-" + BuildProperties.getInstance().getVersion()
|
||||
+ ".jar");
|
||||
if (Files.exists(mvndDaemonLib)) {
|
||||
return mvndH.toString();
|
||||
|
@@ -292,7 +292,7 @@ public class DaemonConnector {
|
||||
}
|
||||
|
||||
private Path findCommonJar(Path mavenHome) {
|
||||
final Path result = mavenHome.resolve("lib/ext/mvnd-common-" + buildProperties.getVersion() + ".jar");
|
||||
final Path result = mavenHome.resolve("mvn/lib/ext/mvnd-common-" + buildProperties.getVersion() + ".jar");
|
||||
if (!Files.isRegularFile(result)) {
|
||||
throw new RuntimeException("File must exist and must be a regular file: " + result);
|
||||
}
|
||||
|
@@ -26,11 +26,11 @@ public class ServerMain {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final String uidStr = Environment.DAEMON_UID.systemProperty().orFail().asString();
|
||||
final Path mavenHome = Environment.MVND_HOME.systemProperty().orFail().asPath();
|
||||
final Path mvndHome = Environment.MVND_HOME.systemProperty().orFail().asPath();
|
||||
URL[] classpath = Stream.concat(
|
||||
/* jars */
|
||||
Stream.of("lib/ext", "lib", "boot")
|
||||
.map(mavenHome::resolve)
|
||||
Stream.of("mvn/lib/ext", "mvn/lib", "mvn/boot")
|
||||
.map(mvndHome::resolve)
|
||||
.flatMap((Path p) -> {
|
||||
try {
|
||||
return Files.list(p);
|
||||
@@ -41,7 +41,7 @@ public class ServerMain {
|
||||
.filter(p -> p.getFileName().toString().endsWith(".jar"))
|
||||
.filter(Files::isRegularFile),
|
||||
/* resources */
|
||||
Stream.of(mavenHome.resolve("conf"), mavenHome.resolve("conf/logging")))
|
||||
Stream.of(mvndHome.resolve("mvn/conf"), mvndHome.resolve("mvn/conf/logging")))
|
||||
|
||||
.map(Path::normalize)
|
||||
.map(Path::toUri)
|
||||
|
@@ -196,7 +196,7 @@ exec "$JAVACMD" \
|
||||
-Dmvnd.logging=mvns \
|
||||
"-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \
|
||||
"-Dmvnd.home=${MAVEN_HOME}" \
|
||||
"-Dmaven.home=${MAVEN_HOME}" \
|
||||
"-Dmaven.home=${MAVEN_HOME}/mvn" \
|
||||
"-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${CLASSWORLDS_LAUNCHER} --builder smart --threads 0.5C "$@"
|
||||
|
@@ -200,11 +200,11 @@ public class DaemonMavenCli {
|
||||
// Make sure the Maven home directory is an absolute path to save us from confusion with say drive-relative
|
||||
// Windows paths.
|
||||
//
|
||||
String mavenHome = System.getProperty("mvnd.home");
|
||||
String mvndHome = System.getProperty("mvnd.home");
|
||||
|
||||
if (mavenHome != null) {
|
||||
System.setProperty("mvnd.home", new File(mavenHome).getAbsolutePath());
|
||||
System.setProperty("maven.home", new File(mavenHome).getAbsolutePath());
|
||||
if (mvndHome != null) {
|
||||
System.setProperty("mvnd.home", new File(mvndHome).getAbsolutePath());
|
||||
System.setProperty("maven.home", new File(mvndHome + "/mvn").getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,14 +17,14 @@
|
||||
-->
|
||||
<assembly>
|
||||
|
||||
<artifactSet to="mvnd-${project.version}-${os.detected.name}-${os.detected.arch}">
|
||||
<artifactSet to="mvnd-${project.version}-${os.detected.name}-${os.detected.arch}/mvn">
|
||||
<artifact id="org.apache.maven:apache-maven:tar.gz:bin">
|
||||
<unpack useRoot="false"
|
||||
excludes="lib/slf4j*,conf/logging/*,lib/maven-slf4j-provider*,bin/mvn*,lib/jansi-*.jar,lib/jansi-native/*"/>
|
||||
</artifact>
|
||||
</artifactSet>
|
||||
|
||||
<artifactSet to="mvnd-${project.version}-${os.detected.name}-${os.detected.arch}/lib/ext">
|
||||
<artifactSet to="mvnd-${project.version}-${os.detected.name}-${os.detected.arch}/mvn/lib/ext">
|
||||
<artifact id="org.jboss.fuse.mvnd:mvnd-daemon:${project.version}">
|
||||
<exclusion id="org.codehaus.plexus:plexus-classworlds"/>
|
||||
<exclusion id="*:cdi-api"/>
|
||||
|
@@ -37,17 +37,18 @@ public class DistroIT {
|
||||
@Test
|
||||
void noDuplicateJars() {
|
||||
final Path mavenHome = Paths.get(System.getProperty("mvnd.home"));
|
||||
Set<Avc> mavenLibs = streamJars(mavenHome, "lib", "boot").collect(Collectors.toCollection(TreeSet::new));
|
||||
Set<Avc> mavenLibs = streamJars(mavenHome, "mvn/lib", "mvn/boot").collect(Collectors.toCollection(TreeSet::new));
|
||||
Assertions.assertFalse(mavenLibs.isEmpty());
|
||||
final List<Avc> mvndJars = streamJars(mavenHome, "lib/ext").collect(Collectors.toList());
|
||||
final List<Avc> mvndJars = streamJars(mavenHome, "mvn/lib/ext").collect(Collectors.toList());
|
||||
Assertions.assertFalse(mvndJars.isEmpty());
|
||||
|
||||
final List<Avc> dups = mvndJars.stream()
|
||||
.filter(avc -> mavenLibs.stream().anyMatch(mvnAvc -> mvnAvc.sameArtifactId(avc)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final String msg = mavenHome.resolve("lib/ext") + " contains duplicates available in " + mavenHome.resolve("lib")
|
||||
+ " or " + mavenHome.resolve("lib");
|
||||
final String msg = mavenHome.resolve("mvn/lib/ext") + " contains duplicates available in "
|
||||
+ mavenHome.resolve("mvn/lib")
|
||||
+ " or " + mavenHome.resolve("mvn/lib");
|
||||
Assertions.assertEquals(new ArrayList<String>(), dups, msg);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user