You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/11/20 16:32:27 UTC

[maven-site-plugin] branch MSITE-812 created (now 0e1362fd)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch MSITE-812
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git


      at 0e1362fd [MSITE-912] Reporting plugins never executed if more than one locale is configured

This branch includes the following new commits:

     new 0e1362fd [MSITE-912] Reporting plugins never executed if more than one locale is configured

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-site-plugin] 01/01: [MSITE-912] Reporting plugins never executed if more than one locale is configured

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MSITE-812
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git

commit 0e1362fd6ac2f746f57914c37ab8e86b934e6412
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Nov 19 23:22:16 2022 +0100

    [MSITE-912] Reporting plugins never executed if more than one locale is configured
    
    Don't clear reports list since the next locale will need it to repeat generation.
    
    This closes #110
---
 src/it/projects/site-sd-lang/verify.bsh            | 58 ++++++++++++++++++++++
 .../site/render/AbstractSiteRenderingMojo.java     |  7 +--
 2 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/src/it/projects/site-sd-lang/verify.bsh b/src/it/projects/site-sd-lang/verify.bsh
index 0d1f6f56..3a029733 100644
--- a/src/it/projects/site-sd-lang/verify.bsh
+++ b/src/it/projects/site-sd-lang/verify.bsh
@@ -26,6 +26,64 @@ boolean result = true;
 
 try
 {
+    // SITE
+
+    File topLevelDirectory = new File( basedir, "target/site" );
+    if ( !topLevelDirectory.exists() || !topLevelDirectory.isDirectory() )
+    {
+        System.err.println( "Site directory '" + topLevelDirectory + "' is missing or not a directory." );
+        return false;
+    }
+
+    File moduleDirectory = new File( basedir, "mymodule/target/site" );
+    if ( !moduleDirectory.exists() || !moduleDirectory.isDirectory() )
+    {
+        System.err.println( "Site module directory '" + moduleDirectory + "' is missing or not a directory." );
+        return false;
+    }
+
+    File projectInfoDirectory = new File( topLevelDirectory, "project-info.html" );
+    if ( !projectInfoDirectory.exists() || !projectInfoDirectory.isFile() )
+    {
+        System.err.println( "Site project-info.html '" + projectInfoDirectory + "' is missing or not a file." );
+        return false;
+    }
+
+    File frDirectory = new File( topLevelDirectory, "fr" );
+    if ( !frDirectory.exists() || !frDirectory.isDirectory() )
+    {
+        System.err.println( "Site fr directory '" + frDirectory + "' is missing or not a directory." );
+        return false;
+    }
+
+    File frProjectInfoDirectory = new File( frDirectory, "project-info.html" );
+    if ( !frProjectInfoDirectory.exists() || !frProjectInfoDirectory.isFile() )
+    {
+        System.err.println( "Site fr project-info.html '" + frProjectInfoDirectory + "' is missing or not a file." );
+        return false;
+    }
+
+    File frModuleDirectory = new File( moduleDirectory, "fr" );
+    if ( !frModuleDirectory.exists() || !frModuleDirectory.isDirectory() )
+    {
+        System.err.println( "Site fr module directory '" + frModuleDirectory + "' is missing or not a directory." );
+        return false;
+    }
+
+    File moduleProjectInfoDirectory = new File( moduleDirectory, "project-info.html" );
+    if ( !moduleProjectInfoDirectory.exists() || !moduleProjectInfoDirectory.isFile() )
+    {
+        System.err.println( "Site module project-info.html '" + moduleProjectInfoDirectory + "' is missing or not a file." );
+        return false;
+    }
+
+    File frModuleProjectInfoDirectory = new File( frModuleDirectory, "project-info.html" );
+    if ( !frModuleProjectInfoDirectory.exists() || !frModuleProjectInfoDirectory.isFile() )
+    {
+        System.err.println( "Site fr module project-info.html '" + frModuleProjectInfoDirectory + "' is missing or not a file." );
+        return false;
+    }
+
     // STAGING
 
     File topLevelDirectory = new File( basedir, "target/staging" );
diff --git a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
index 589470f0..898b584e 100644
--- a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
@@ -356,11 +356,8 @@ public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMo
     protected Map<String, MavenReport> locateReports( List<MavenReportExecution> reports,
                                                       Map<String, DocumentRenderer> documents, Locale locale )
     {
-        // copy Collection to prevent ConcurrentModificationException
-        List<MavenReportExecution> filtered = new ArrayList<>( reports );
-
         Map<String, MavenReport> reportsByOutputName = new LinkedHashMap<>();
-        for ( MavenReportExecution mavenReportExecution : filtered )
+        for ( MavenReportExecution mavenReportExecution : reports )
         {
             MavenReport report = mavenReportExecution.getMavenReport();
 
@@ -378,8 +375,6 @@ public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMo
 
                 getLog().info( "Skipped \"" + report.getName( locale ) + "\" report" + reportMojoInfo + ", file \""
                                    + outputName + "\" already exists." );
-
-                reports.remove( mavenReportExecution );
             }
             else
             {