Skip to content

Commit

Permalink
Make sure that maven-dependency-plugin is downloaded when not yet pre…
Browse files Browse the repository at this point in the history
…sent
  • Loading branch information
rodinaarssen committed Sep 17, 2024
1 parent d181d88 commit badd6e0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/org/rascalmpl/library/util/PathConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit badd6e0

Please sign in to comment.