Skip to content

Commit

Permalink
One more attempt to workaround #281
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Jan 8, 2021
1 parent b958a91 commit 0f438bd
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
15 changes: 11 additions & 4 deletions integration-tests/pom.xml
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Expand Up @@ -50,7 +50,6 @@ void cleanInstall() throws IOException, InterruptedException {
}

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"),
Expand Down
Expand Up @@ -51,7 +51,6 @@ void cleanInstall() throws IOException, InterruptedException {
});

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"),
Expand Down
Expand Up @@ -59,7 +59,6 @@ void cleanInstall() throws IOException, InterruptedException {
});

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"),
Expand Down
Expand Up @@ -49,7 +49,6 @@ void cleanInstall() throws IOException, InterruptedException {
}

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();
Expand Down
Expand Up @@ -229,12 +229,10 @@ public static MvndResource create(String className, String rawProjectDir, boolea

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)) {
Expand All @@ -243,7 +241,7 @@ private static void prefillLocalRepo(final Path localMavenRepository) {
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);
}
Expand Down

0 comments on commit 0f438bd

Please sign in to comment.