This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch replace-old-resolution in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git
The following commit(s) were added to refs/heads/replace-old-resolution by this push: new a624f1a Require in reactor available immediate child module projects passed a624f1a is described below commit a624f1a5d113377f98a67eb698d8bbeffad4ce84 Author: Michael Osipov <micha...@apache.org> AuthorDate: Wed Mar 15 00:24:00 2023 +0100 Require in reactor available immediate child module projects passed --- .../org/apache/maven/doxia/tools/DefaultSiteTool.java | 15 +++++++++++---- .../main/java/org/apache/maven/doxia/tools/SiteTool.java | 2 ++ .../java/org/apache/maven/doxia/tools/SiteToolTest.java | 10 +++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java index 8c1ba7f..270abd6 100644 --- a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java +++ b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java @@ -371,11 +371,13 @@ public class DefaultSiteTool implements SiteTool { File siteDirectory, Locale locale, MavenProject project, + List<MavenProject> projectModules, RepositorySystemSession repoSession, List<RemoteRepository> remoteProjectRepositories) throws SiteToolException { Objects.requireNonNull(locale, "locale cannot be null"); Objects.requireNonNull(project, "project cannot be null"); + Objects.requireNonNull(projectModules, "projectModules cannot be null"); Objects.requireNonNull(repoSession, "repoSession cannot be null"); Objects.requireNonNull(remoteProjectRepositories, "remoteProjectRepositories cannot be null"); @@ -405,7 +407,7 @@ public class DefaultSiteTool implements SiteTool { } try { - populateModulesMenu(decorationModel, locale, project, true); + populateModulesMenu(decorationModel, locale, project, projectModules, true); } catch (IOException e) { throw new SiteToolException("Error while populating modules menu", e); } @@ -537,16 +539,22 @@ public class DefaultSiteTool implements SiteTool { * @param decorationModel the Doxia Sitetools DecorationModel, not null. * @param locale the locale used for the i18n in DecorationModel, not null. * @param project a Maven project, not null. + * @param projectModules the project modules, not null. * @param keepInheritedRefs used for inherited references. * @throws SiteToolException if any * @throws IOException */ private void populateModulesMenu( - DecorationModel decorationModel, Locale locale, MavenProject project, boolean keepInheritedRefs) + DecorationModel decorationModel, + Locale locale, + MavenProject project, + List<MavenProject> projectModules, + boolean keepInheritedRefs) throws SiteToolException, IOException { Objects.requireNonNull(decorationModel, "decorationModel cannot be null"); Objects.requireNonNull(locale, "locale cannot be null"); Objects.requireNonNull(project, "project cannot be null"); + Objects.requireNonNull(projectModules, "projectModules cannot be null"); Menu menu = decorationModel.getMenuRef("modules"); @@ -559,8 +567,7 @@ public class DefaultSiteTool implements SiteTool { } // we require child modules and reactors to process module menu - List<MavenProject> projectModules = project.getCollectedProjects(); - if (projectModules != null && !projectModules.isEmpty()) { + if (!projectModules.isEmpty()) { if (menu.getName() == null) { menu.setName(i18n.getString("site-tool", locale, "decorationModel.menu.projectmodules")); } diff --git a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java index 65b7af9..1c82bd1 100644 --- a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java +++ b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java @@ -114,6 +114,7 @@ public interface SiteTool { * @param locale the locale used for the i18n in DecorationModel, not null. * See {@link #getSiteDescriptor(File, Locale)} for details. * @param project the Maven project, not null. + * @param projectModules the project modules, not null. * @param repoSession the repository system session, not null. * @param remoteProjectRepositories the Maven remote project repositories, not null. * @return the <code>DecorationModel</code> object corresponding to the <code>site.xml</code> file with some @@ -125,6 +126,7 @@ public interface SiteTool { File siteDirectory, Locale locale, MavenProject project, + List<MavenProject> projectModules, RepositorySystemSession repoSession, List<RemoteRepository> remoteProjectRepositories) throws SiteToolException; diff --git a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java index d89732f..9f74575 100644 --- a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java +++ b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java @@ -358,6 +358,7 @@ public class SiteToolTest { new File(project.getBasedir(), "src/site"), SiteTool.DEFAULT_LOCALE, project, + Collections.emptyList(), newRepoSession(), project.getRemoteProjectRepositories()); assertNotNull(model); @@ -380,7 +381,12 @@ public class SiteToolTest { project.setArtifactId("maven"); project.setVersion("3.8.6"); DecorationModel modelFromRepo = tool.getDecorationModel( - null, SiteTool.DEFAULT_LOCALE, project, newRepoSession(), project.getRemoteProjectRepositories()); + null, + SiteTool.DEFAULT_LOCALE, + project, + Collections.emptyList(), + newRepoSession(), + project.getRemoteProjectRepositories()); assertNotNull(modelFromRepo); assertNotNull(modelFromRepo.getBannerLeft()); assertEquals("dummy", modelFromRepo.getBannerLeft().getName()); @@ -405,6 +411,7 @@ public class SiteToolTest { new File(project.getBasedir(), siteDirectory), SiteTool.DEFAULT_LOCALE, project, + Collections.emptyList(), newRepoSession(), project.getRemoteProjectRepositories()); assertNotNull(model); @@ -464,6 +471,7 @@ public class SiteToolTest { new File(childProject.getBasedir(), "src/site"), SiteTool.DEFAULT_LOCALE, childProject, + Collections.emptyList(), newRepoSession(), childProject.getRemoteProjectRepositories()); assertNotNull(model);