Skip to content

Commit

Permalink
One more attempt to workaround apache#281
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Jan 8, 2021
1 parent b958a91 commit af73884
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
19 changes: 15 additions & 4 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@
<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>
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>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down Expand Up @@ -172,8 +178,13 @@
<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>
org/apache/maven/surefire/surefire-providers/${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>
</systemPropertyVariables>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
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 af73884

Please sign in to comment.