From badd6e0b6f37c04cc49685cd4f72c76fb2200449 Mon Sep 17 00:00:00 2001 From: Rodin Aarssen Date: Tue, 17 Sep 2024 17:10:47 +0200 Subject: [PATCH] Make sure that maven-dependency-plugin is downloaded when not yet present --- src/org/rascalmpl/library/util/PathConfig.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/org/rascalmpl/library/util/PathConfig.java b/src/org/rascalmpl/library/util/PathConfig.java index a76fb5661a7..135e929bafd 100644 --- a/src/org/rascalmpl/library/util/PathConfig.java +++ b/src/org/rascalmpl/library/util/PathConfig.java @@ -635,8 +635,13 @@ private static ISourceLocation setTargetScheme(ISourceLocation projectLoc) { */ private static IList getPomXmlCompilerClasspath(ISourceLocation manifestRoot) { try { + String mavenDependencyPlugin = "org.apache.maven.plugins:maven-dependency-plugin:3.8.0"; + // First, make sure that maven-dependency-plugin is downloaded when not available + Maven.runCommand(List.of(mavenDependencyPlugin + ":do-nothing"), manifestRoot); + + // Now, actually let maven build the classpath. Note that this is in offline mode as to not download any dependencies var tempFile = Maven.getTempFile("classpath"); - var mavenOutput = Maven.runCommand(List.of("-o", "org.apache.maven.plugins:maven-dependency-plugin:3.8.0:build-classpath", "-DincludeScope=compile", "-Dmdep.outputFile=" + tempFile.toString()), manifestRoot, tempFile); + var mavenOutput = Maven.runCommand(List.of("-o", mavenDependencyPlugin + ":build-classpath", "-DincludeScope=compile", "-Dmdep.outputFile=" + tempFile.toString()), manifestRoot, tempFile); // The classpath will be written to the temp file on a single line return Arrays.stream(mavenOutput.get(0).split(File.pathSeparator))