Skip to content

Commit

Permalink
Merge pull request #12603 from aloubyansky/no-maven-projectbasedir
Browse files Browse the repository at this point in the history
Bootstrap Maven: don't check MAVEN_PROJECTBASEDIR for the root project dir
  • Loading branch information
gsmet authored Oct 9, 2020
2 parents 4d7fe36 + 889b46d commit 24abf81
Showing 1 changed file with 5 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,28 +794,10 @@ public Path getCurrentProjectBaseDir() {
}

public Path getRootProjectBaseDir() {
return rootProjectDir == null ? rootProjectDir = resolveRootProjectDir() : rootProjectDir;
}

private Path resolveRootProjectDir() {
final String rootBaseDir = System.getenv(MAVEN_PROJECTBASEDIR);
if (rootBaseDir == null) {
return null;
}
// if the alternate POM was set (not on the CLI) and its base dir does not match the base dir
// set by the Maven process then the root project set by the Maven process is probably not relevant too
if (alternatePomName != null) {
final Path currentPom = getCurrentProjectPomOrNull();
if (currentPom == null || !getCurrentProjectBaseDir().equals(currentPom.getParent())) {
return null;
}
}
final Path rootProjectBaseDirPath = Paths.get(rootBaseDir);
// if the root project dir set by the Maven process (through the env variable) doesn't have a pom.xml
// then it probably isn't relevant
if (!Files.exists(rootProjectBaseDirPath.resolve("pom.xml"))) {
return null;
}
return rootProjectBaseDirPath;
// originally we checked for MAVEN_PROJECTBASEDIR which is set by the mvn script
// and points to the first parent containing '.mvn' dir but it's not consistent
// with how Maven discovers the workspace and also created issues testing the Quarkus platform
// due to its specific FS layout
return rootProjectDir;
}
}

0 comments on commit 24abf81

Please sign in to comment.