diff --git a/maven-core/src/main/java/org/apache/maven/ReactorReader.java b/maven-core/src/main/java/org/apache/maven/ReactorReader.java index 42cccba15640..edba95447f00 100644 --- a/maven-core/src/main/java/org/apache/maven/ReactorReader.java +++ b/maven-core/src/main/java/org/apache/maven/ReactorReader.java @@ -279,9 +279,8 @@ private boolean hasBeenPackagedDuringThisSession(MavenProject project) { } private Path relativizeOutputFile(final Path outputFile) { - Path projectBaseDirectory = - Paths.get(session.getRequest().getMultiModuleProjectDirectory().toURI()); - return projectBaseDirectory.relativize(outputFile); + Path rootDirectory = session.getRequest().getRootDirectory(); + return rootDirectory.relativize(outputFile); } /** @@ -445,7 +444,7 @@ private Path getArtifactPath(Artifact artifact) { private Path getProjectLocalRepo() { if (projectLocalRepository == null) { - Path root = session.getRequest().getMultiModuleProjectDirectory().toPath(); + Path root = session.getRequest().getRootDirectory(); List projects = session.getProjects(); if (projects != null) { projectLocalRepository = projects.stream() diff --git a/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java b/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java index 1216f081b291..921579f1c29f 100644 --- a/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java +++ b/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java @@ -61,7 +61,7 @@ public MultiModuleCollectionStrategy(ModelLocator modelLocator, ProjectsSelector @Override public List collectProjects(MavenExecutionRequest request) throws ProjectBuildingException { - File moduleProjectPomFile = getMultiModuleProjectPomFile(request); + File moduleProjectPomFile = getRootProject(request); List files = Collections.singletonList(moduleProjectPomFile.getAbsoluteFile()); try { List projects = projectsSelector.selectProjects(files, request); @@ -96,24 +96,24 @@ public List collectProjects(MavenExecutionRequest request) throws } } - private File getMultiModuleProjectPomFile(MavenExecutionRequest request) { - File multiModuleProjectDirectory = request.getMultiModuleProjectDirectory(); - if (request.getPom().getParentFile().equals(multiModuleProjectDirectory)) { + private File getRootProject(MavenExecutionRequest request) { + File rootDirectory = request.getRootDirectory().toFile(); + if (request.getPom().getParentFile().equals(rootDirectory)) { return request.getPom(); } else { - File multiModuleProjectPom = modelLocator.locateExistingPom(multiModuleProjectDirectory); - if (multiModuleProjectPom == null) { + File rootProjectPom = modelLocator.locateExistingPom(rootDirectory); + if (rootProjectPom == null) { LOGGER.info( "Maven detected that the requested POM file is part of a multi-module project, " - + "but could not find a pom.xml file in the multi-module root directory '{}'.", - multiModuleProjectDirectory); + + "but could not find a pom.xml file in the root directory '{}'.", + rootDirectory); LOGGER.info( "The reactor is limited to all projects under: {}", request.getPom().getParent()); return request.getPom(); } - return multiModuleProjectPom; + return rootProjectPom; } }