One more attempt to workaround #281

This commit is contained in:
Peter Palaga
2021-01-08 13:26:51 +01:00
parent b958a91405
commit 0f438bdb09
6 changed files with 15 additions and 14 deletions

View File

@@ -33,6 +33,15 @@
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<mvnd.home>${project.basedir}/../dist/target/mvnd-${project.version}-${os.detected.name}-${os.detected.arch}</mvnd.home>
<preinstall.artifacts>
org/apache/maven/surefire/surefire-providers/${surefire.version}
org/apache/maven/surefire/surefire-junit-platform/${surefire.version}
org/junit/platform/junit-platform-launcher/${junit-platform-launcher.version}
org/junit/platform/junit-platform-engine/${junit-platform-launcher.version}
org/junit/jupiter/junit-jupiter/${junit.jupiter.version}
org/junit/jupiter/junit-jupiter-api/${junit.jupiter.version}
</preinstall.artifacts>
</properties>
<dependencies>
@@ -88,8 +97,7 @@
<os.detected.name>${os.detected.name}</os.detected.name>
<os.detected.arch>${os.detected.arch}</os.detected.arch>
<mvnd.test.hostLocalMavenRepo>${settings.localRepository}</mvnd.test.hostLocalMavenRepo>
<surefire.version>${surefire.version}</surefire.version>
<junit-platform-launcher.version>${junit-platform-launcher.version}</junit-platform-launcher.version>
<preinstall.artifacts>${preinstall.artifacts}</preinstall.artifacts>
</systemPropertyVariables>
</configuration>
</plugin>
@@ -172,8 +180,7 @@
<os.detected.name>${os.detected.name}</os.detected.name>
<os.detected.arch>${os.detected.arch}</os.detected.arch>
<mvnd.test.hostLocalMavenRepo>${settings.localRepository}</mvnd.test.hostLocalMavenRepo>
<surefire.version>${surefire.version}</surefire.version>
<junit-platform-launcher.version>${junit-platform-launcher.version}</junit-platform-launcher.version>
<preinstall.artifacts>${preinstall.artifacts}</preinstall.artifacts>
</systemPropertyVariables>
</configuration>
</execution>

View File

@@ -50,7 +50,6 @@ public class DaemonCrashTest {
}
final Path localMavenRepo = parameters.mavenRepoLocal();
TestUtils.deleteDir(localMavenRepo);
final Path[] installedJars = {
localMavenRepo.resolve(
"org/mvndaemon/mvnd/test/daemon-crash/daemon-crash-maven-plugin/0.0.1-SNAPSHOT/daemon-crash-maven-plugin-0.0.1-SNAPSHOT.jar"),

View File

@@ -51,7 +51,6 @@ public class ModuleAndPluginNativeIT {
});
final Path localMavenRepo = parameters.mavenRepoLocal();
TestUtils.deleteDir(localMavenRepo);
final Path[] installedJars = {
localMavenRepo.resolve(
"org/mvndaemon/mvnd/test/module-and-plugin/module-and-plugin-maven-plugin/0.0.1-SNAPSHOT/module-and-plugin-maven-plugin-0.0.1-SNAPSHOT.jar"),

View File

@@ -59,7 +59,6 @@ public class MultiModuleTest {
});
final Path localMavenRepo = parameters.mavenRepoLocal();
TestUtils.deleteDir(localMavenRepo);
final Path[] installedJars = {
localMavenRepo.resolve(
"org/mvndaemon/mvnd/test/multi-module/multi-module-api/0.0.1-SNAPSHOT/multi-module-api-0.0.1-SNAPSHOT.jar"),

View File

@@ -49,7 +49,6 @@ public class SingleModuleNativeIT {
}
final Path localMavenRepo = parameters.mavenRepoLocal();
TestUtils.deleteDir(localMavenRepo);
final Path installedJar = localMavenRepo.resolve(
"org/mvndaemon/mvnd/test/single-module/single-module/0.0.1-SNAPSHOT/single-module-0.0.1-SNAPSHOT.jar");
Assertions.assertThat(installedJar).doesNotExist();

View File

@@ -229,12 +229,10 @@ public class MvndTestExtension implements BeforeAllCallback, BeforeEachCallback,
private static void prefillLocalRepo(final Path localMavenRepository) {
/* Workaround for https://github.com/mvndaemon/mvnd/issues/281 */
final String surefireVersion = System.getProperty("surefire.version");
final String junitPlatformLauncherVersion = System.getProperty("junit-platform-launcher.version");
final String preinstallArtifacts = System.getProperty("preinstall.artifacts").trim();
final Path hostLocalMavenRepo = Paths.get(System.getProperty("mvnd.test.hostLocalMavenRepo"));
Stream.of(
"org/apache/maven/surefire/surefire-providers/" + surefireVersion,
"org/junit/platform/junit-platform-launcher/" + junitPlatformLauncherVersion)
Stream.of(preinstallArtifacts.split("[\\s,]+"))
.forEach(relPath -> {
final Path src = hostLocalMavenRepo.resolve(relPath);
if (Files.isDirectory(src)) {
@@ -243,7 +241,7 @@ public class MvndTestExtension implements BeforeAllCallback, BeforeEachCallback,
final Path dest = localMavenRepository.resolve(relPath).resolve(file.getFileName());
try {
Files.createDirectories(dest.getParent());
Files.copy(src, dest);
Files.copy(file, dest);
} catch (IOException e) {
throw new UncheckedIOException(e);
}