Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap Maven: don't check MAVEN_PROJECTBASEDIR for the root project dir #12603

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}