This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git
commit 76bc531f5cf49f14003af4db56cb0179111869b8 Author: Michael Osipov <micha...@apache.org> AuthorDate: Sun Mar 19 22:54:13 2023 +0100 Simplify getting execution root project by using MavenSession#getTopLevelProject() --- .../maven/plugins/site/deploy/SiteStageMojo.java | 24 +--------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/site/deploy/SiteStageMojo.java b/src/main/java/org/apache/maven/plugins/site/deploy/SiteStageMojo.java index f096d31e..2f33e2a4 100644 --- a/src/main/java/org/apache/maven/plugins/site/deploy/SiteStageMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/deploy/SiteStageMojo.java @@ -19,7 +19,6 @@ package org.apache.maven.plugins.site.deploy; import java.io.File; -import java.util.List; import org.apache.maven.model.Site; import org.apache.maven.plugin.MojoExecutionException; @@ -114,7 +113,7 @@ public class SiteStageMojo extends AbstractStagingMojo { */ protected File getExecutionRootBuildDirectory() { // Find the top level project in the reactor - final MavenProject executionRootProject = getExecutionRootProject(reactorProjects); + final MavenProject executionRootProject = mavenSession.getTopLevelProject(); // Use the top level project's build directory if there is one, otherwise use this project's build directory final File buildDirectory; @@ -132,25 +131,4 @@ public class SiteStageMojo extends AbstractStagingMojo { return buildDirectory; } - - /** - * Find the execution root in the reactor. - * - * @param reactorProjects The projects in the reactor. May be <code>null</code> in which case <code>null</code> is - * returned. - * @return The execution root project in the reactor, or <code>null</code> if none can be found - */ - private static MavenProject getExecutionRootProject(List<MavenProject> reactorProjects) { - if (reactorProjects == null) { - return null; - } - - // todo Lambda Java 1.8 - for (MavenProject reactorProject : reactorProjects) { - if (reactorProject.isExecutionRoot()) { - return reactorProject; - } - } - return null; - } }