Skip to content

Commit

Permalink
Correctly extracting class path from maven output
Browse files Browse the repository at this point in the history
  • Loading branch information
rodinaarssen committed Aug 27, 2024
1 parent d5c655b commit 718a6b3
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/org/rascalmpl/library/util/PathConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,6 @@ private static ISourceLocation setTargetScheme(ISourceLocation projectLoc) {
}
}


private static final Pattern FIND_CLASS_PATH = Pattern.compile("org.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo - Dependencies classpath:\\s+(.+)$", Pattern.MULTILINE);


/**
* See if there is a pom.xml and extract the compile-time classpath from a mvn run
* if there is such a file.
Expand All @@ -663,11 +659,9 @@ private static IList getPomXmlCompilerClasspath(ISourceLocation manifestRoot) {

maven.doMain(buildRequest(new String[] {"-o", "dependency:build-classpath", "-DincludeScope=compile", "-Dmdep.outputFile=" + tempFile.toString()}, manifestRoot));

var mavenOutput = Files.readAllLines(tempFile);
var match = FIND_CLASS_PATH.matcher(mavenOutput.get(0));
var foundClassPath = match.find() ? match.group(1) : "";
var foundClassPath = Files.readAllLines(tempFile);

return Arrays.stream(foundClassPath.split(File.pathSeparator))
return Arrays.stream(foundClassPath.get(0).split(File.pathSeparator))
.filter(fileName -> new File(fileName).exists())
.map(elem -> {
try {
Expand Down

0 comments on commit 718a6b3

Please sign in to comment.