Include mvnd native client in the distro

This commit is contained in:
Peter Palaga
2020-08-14 10:19:55 +02:00
parent accc067007
commit 922403171e
6 changed files with 46 additions and 25 deletions

View File

@@ -30,6 +30,10 @@
<packaging>jar</packaging>
<name>Maven Daemon</name>
<properties>
<os.arch>${os.arch}</os.arch><!-- provisio plugin does not see system properties -->
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.fuse.mvnd</groupId>

View File

@@ -17,23 +17,28 @@
-->
<assembly>
<artifactSet to="/">
<artifactSet to="mvnd-${project.version}-${os.detected.name}-${os.arch}">
<artifact id="org.apache.maven:apache-maven:tar.gz:bin">
<unpack useRoot="false"
excludes="lib/slf4j*,conf/logging/*,lib/maven-slf4j-provider*"/>
excludes="lib/slf4j*,conf/logging/*,lib/maven-slf4j-provider*,bin/mvn*"/>
</artifact>
</artifactSet>
<artifactSet to="lib">
<artifactSet to="mvnd-${project.version}-${os.detected.name}-${os.arch}/lib">
<artifact id="org.apache.maven:maven-embedder"/>
<artifactSet to="ext" ref="runtime.classpath"/>
</artifactSet>
<fileSet to="/">
<fileSet to="mvnd-${project.version}-${os.detected.name}-${os.arch}">
<directory path="${basedir}/src/main/distro"/>
</fileSet>
<fileSet to="mvnd-${project.version}-${os.detected.name}-${os.arch}/bin">
<directory path="${basedir}/../client/target">
<include>mvnd</include>
<include>mvnd.exe</include>
</directory>
</fileSet>
<archive name="mvnd-dist-${project.version}.zip"
executable="**/bin/mvn,**/bin/mvnd,**/bin/mvnDebug,**/bin/mvnyjp"/>
<archive name="mvnd-${project.version}-${os.detected.name}-${os.arch}.zip" executable="**/bin/mvnd"/>
</assembly>

View File

@@ -30,7 +30,7 @@
<name>Maven Daemon - Integration Tests</name>
<properties>
<mvnd.native.executable>${project.basedir}/../client/target/mvnd</mvnd.native.executable>
<mvnd.home>${project.basedir}/../daemon/target/maven-distro/mvnd-${project.version}-${os.detected.name}-${os.arch}</mvnd.home>
</properties>
<dependencies>
@@ -74,8 +74,7 @@
<configuration>
<systemPropertyVariables>
<project.version>${project.version}</project.version>
<mvnd.home>${project.basedir}/../daemon/target/maven-distro</mvnd.home>
<mvnd.dist.path>${project.basedir}/../daemon/target/mvnd-dist-${project.version}.zip</mvnd.dist.path>
<mvnd.home>${mvnd.home}</mvnd.home>
</systemPropertyVariables>
</configuration>
</plugin>
@@ -83,17 +82,6 @@
</build>
<profiles>
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<mvnd.native.executable>${project.basedir}/../client/target/mvnd.exe</mvnd.native.executable>
</properties>
</profile>
<profile>
<id>native</id>
<build>
@@ -110,9 +98,7 @@
<configuration>
<systemPropertyVariables>
<project.version>${project.version}</project.version>
<mvnd.home>${project.basedir}/../daemon/target/maven-distro</mvnd.home>
<mvnd.native.executable>${mvnd.native.executable}</mvnd.native.executable>
<mvnd.dist.path>${project.basedir}/../daemon/target/mvnd-dist-${project.version}.zip</mvnd.dist.path>
<mvnd.home>${mvnd.home}</mvnd.home>
</systemPropertyVariables>
</configuration>
</execution>

View File

@@ -97,7 +97,10 @@ public class MvndTestExtension implements BeforeAllCallback, BeforeEachCallback,
f.set(testInstance, resource.layout);
} else if (f.getType() == Client.class) {
if (resource.isNative) {
final Path mvndNativeExecutablePath = Paths.get(System.getProperty("mvnd.native.executable"))
final Path mvndNativeExecutablePath = resource.layout.mavenHome().resolve(
System.getProperty("os.name").toLowerCase().contains("windows")
? "bin/mvnd.exe"
: "bin/mvnd")
.toAbsolutePath().normalize();
if (!Files.isRegularFile(mvndNativeExecutablePath)) {
throw new IllegalStateException("mvnd executable does not exist: " + mvndNativeExecutablePath);
@@ -176,7 +179,8 @@ public class MvndTestExtension implements BeforeAllCallback, BeforeEachCallback,
.normalize().toAbsolutePath();
if (!Files.isDirectory(mvndHome)) {
throw new IllegalStateException(
"The value of mvnd.home system property points at a path that does not exist or is not a directory");
"The value of mvnd.home system property points at a path that does not exist or is not a directory: "
+ mvndHome);
}
final Path mvndPropertiesPath = testDir.resolve("mvnd.properties");
final Path localMavenRepository = deleteDir(testDir.resolve("local-maven-repo"));

22
pom.xml
View File

@@ -50,6 +50,8 @@
<!-- plugin versions a..z -->
<compiler.version>3.8.1</compiler.version>
<formatter-maven-plugin.version>2.12.1</formatter-maven-plugin.version>
<groovy-maven-plugin.version>2.1.1</groovy-maven-plugin.version>
<groovy.version>3.0.4</groovy.version>
<impsort-maven-plugin.version>1.4.1</impsort-maven-plugin.version>
<license-maven-plugin.version>3.0</license-maven-plugin.version>
<mrm.version>1.2.0</mrm.version>
@@ -286,6 +288,26 @@ limitations under the License.</inlineHeader>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>${groovy-maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<type>pom</type>
<exclusions>
<exclusion>
<!-- groovy-testng depends on testng 7.2.0 wich is not on maven central -->
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-testng</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mrm-maven-plugin</artifactId>