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 2023/02/11 20:51:27 UTC

[maven-project-info-reports-plugin] branch doxia-2.0.0 updated (f0f7c03 -> 3b0f78c)

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

michaelo pushed a change to branch doxia-2.0.0
in repository https://gitbox.apache.org/repos/asf/maven-project-info-reports-plugin.git


    omit f0f7c03  Prepare for Doxia 2.0.0
     add d6a6c9c  Fix jenkins URL
     new 3b0f78c  Prepare for Doxia 2.0.0

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f0f7c03)
            \
             N -- N -- N   refs/heads/doxia-2.0.0 (3b0f78c)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[maven-project-info-reports-plugin] 01/01: Prepare for Doxia 2.0.0

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

michaelo pushed a commit to branch doxia-2.0.0
in repository https://gitbox.apache.org/repos/asf/maven-project-info-reports-plugin.git

commit 3b0f78c56e64f6daabed99bc9d23f157700b0587
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Jul 2 23:58:47 2022 +0200

    Prepare for Doxia 2.0.0
---
 pom.xml                                            |   2 +-
 src/it/dependencies-java-1.7-and-1.8/verify.groovy |  28 ++---
 src/it/full-pom/pom.xml                            |   2 +-
 src/it/minimal-pom/pom.xml                         |   2 +-
 src/it/multi-module/pom.xml                        |   5 +-
 src/it/multi-module/verify.groovy                  |   4 +-
 .../projectinfo/AbstractProjectInfoReport.java     |   1 +
 .../renderer/DependenciesRenderer.java             | 138 +--------------------
 .../projectinfo/AbstractProjectInfoTestCase.java   |  16 +--
 .../report/projectinfo/MailingListsReportTest.java |  16 +--
 .../report/projectinfo/ModulesReportTest.java      |   3 +-
 .../maven/report/projectinfo/ScmReportTest.java    |   3 +-
 .../maven/report/projectinfo/TeamReportTest.java   |   3 +-
 .../mailing-lists-plugin-config-fr.xml             |  61 +++++++++
 14 files changed, 101 insertions(+), 183 deletions(-)

diff --git a/pom.xml b/pom.xml
index c611962..5456729 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@ under the License.
   </parent>
 
   <artifactId>maven-project-info-reports-plugin</artifactId>
-  <version>3.4.3-SNAPSHOT</version>
+  <version>4.0.0-M1-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Apache Maven Project Info Reports Plugin</name>
diff --git a/src/it/dependencies-java-1.7-and-1.8/verify.groovy b/src/it/dependencies-java-1.7-and-1.8/verify.groovy
index 2edcd4e..2a344fe 100644
--- a/src/it/dependencies-java-1.7-and-1.8/verify.groovy
+++ b/src/it/dependencies-java-1.7-and-1.8/verify.groovy
@@ -19,24 +19,24 @@
 File dependencies = new File( basedir, 'target/site/dependencies.html' )
 def mavenModel = '''\
 <tr class="a">
-<td align="left">maven-model-3.3.9.jar</td>
-<td align="right">164 kB</td>
-<td align="right">71</td>
-<td align="right">54</td>
-<td align="right">3</td>
-<td align="center">1.7</td>
-<td align="center">Yes</td></tr>
+<td style="text-align: left;">maven-model-3.3.9.jar</td>
+<td style="text-align: right;">164 kB</td>
+<td style="text-align: right;">71</td>
+<td style="text-align: right;">54</td>
+<td style="text-align: right;">3</td>
+<td style="text-align: center;">1.7</td>
+<td style="text-align: center;">Yes</td></tr>
 '''
 
 def jacksonDataTypeJsr310 = '''\
 <tr class="a">
-<td align="left">jackson-datatype-jsr310-2.6.4.jar</td>
-<td align="right">78.1 kB</td>
-<td align="right">69</td>
-<td align="right">51</td>
-<td align="right">5</td>
-<td align="center">1.8</td>
-<td align="center">Yes</td></tr>
+<td style="text-align: left;">jackson-datatype-jsr310-2.6.4.jar</td>
+<td style="text-align: right;">78.1 kB</td>
+<td style="text-align: right;">69</td>
+<td style="text-align: right;">51</td>
+<td style="text-align: right;">5</td>
+<td style="text-align: center;">1.8</td>
+<td style="text-align: center;">Yes</td></tr>
 '''
 
 assert dependencies.text.contains( mavenModel.replaceAll( "\n", System.getProperty( "line.separator" ) ) )
diff --git a/src/it/full-pom/pom.xml b/src/it/full-pom/pom.xml
index c6e92f3..ff4ef62 100644
--- a/src/it/full-pom/pom.xml
+++ b/src/it/full-pom/pom.xml
@@ -174,7 +174,7 @@
           <artifactId>maven-site-plugin</artifactId>
           <version>@sitePluginVersion@</version>
           <configuration>
-            <locales>en,cs,de,en,es,fr,gl,hu,it,ja,ko,lt,nl,no,pl,pt,pt_BR,ru,sk,sv,tr,zh_CN,zh_TW</locales>
+            <locales>default,en,cs,de,en,es,fr,gl,hu,it,ja,ko,lt,nl,no,pl,pt,pt_BR,ru,sk,sv,tr,zh_CN,zh_TW</locales>
           </configuration>
         </plugin>
       </plugins>
diff --git a/src/it/minimal-pom/pom.xml b/src/it/minimal-pom/pom.xml
index a2c013b..0c92814 100644
--- a/src/it/minimal-pom/pom.xml
+++ b/src/it/minimal-pom/pom.xml
@@ -44,7 +44,7 @@
           <artifactId>maven-site-plugin</artifactId>
           <version>@sitePluginVersion@</version>
           <configuration>
-            <locales>en,cs,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN,zh_TW</locales>
+            <locales>default,en,cs,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN,zh_TW</locales>
           </configuration>
         </plugin>
       </plugins>
diff --git a/src/it/multi-module/pom.xml b/src/it/multi-module/pom.xml
index 60cd695..cccb3d0 100644
--- a/src/it/multi-module/pom.xml
+++ b/src/it/multi-module/pom.xml
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>16</version>
+    <version>28</version>
   </parent>
 
   <groupId>org.apache.maven.plugins.project-info-reports.its</groupId>
@@ -79,9 +79,6 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
         <version>@sitePluginVersion@</version>
-        <configuration>
-          <locales>en</locales>
-        </configuration>
       </plugin>
     </plugins>
   </build>
diff --git a/src/it/multi-module/verify.groovy b/src/it/multi-module/verify.groovy
index 7fdfb6b..afc2cb4 100644
--- a/src/it/multi-module/verify.groovy
+++ b/src/it/multi-module/verify.groovy
@@ -21,5 +21,5 @@ File mainDependencies = new File( basedir, 'main/target/site/dependencies.html'
 
 // Dependency File Details section should display dep-1.0-SNAPSHOT.jar packaged from previous build (package phase),
 // not dep/target/classes from current build (site phase)
-assert !mainDependencies.text.contains( '<td align="left">dep/target/classes</td>' )
-assert mainDependencies.text.contains( '<td align="left">dep-1.0-SNAPSHOT.jar</td>' )
+assert !mainDependencies.text.contains( '<td style="text-align: left;">dep/target/classes</td>' )
+assert mainDependencies.text.contains( '<td style="text-align: left;">dep-1.0-SNAPSHOT.jar</td>' )
diff --git a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java
index 4d6f9c9..8fb5027 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java
@@ -329,6 +329,7 @@ public abstract class AbstractProjectInfoReport
         return getI18nString( locale, "description" );
     }
 
+    // TODO Review, especially Locale.getDefault()
     private static class CustomI18N
         implements I18N
     {
diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
index 02f848a..a5afcd1 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
@@ -43,7 +43,6 @@ import org.apache.maven.artifact.Artifact;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.SinkEventAttributes;
 import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
-import org.apache.maven.doxia.util.HtmlTools;
 import org.apache.maven.model.License;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
@@ -96,11 +95,6 @@ public class DependenciesRenderer
     /** Used to format file length values */
     private final DecimalFormat fileLengthDecimalFormat;
 
-    /**
-     * @since 2.1.1
-     */
-    private int section;
-
     /** Counter for unique IDs that is consistent across generations. */
     private int idCounter = 0;
 
@@ -236,124 +230,6 @@ public class DependenciesRenderer
         }
     }
 
-    // ----------------------------------------------------------------------
-    // Protected methods
-    // ----------------------------------------------------------------------
-
-    /** {@inheritDoc} */
-    // workaround for MPIR-140
-    // TODO Remove me when MSHARED-390 has been resolved
-    @Override
-    protected void startSection( String name )
-    {
-        startSection( name, name );
-    }
-
-    /**
-     * Start section with a name and a specific anchor.
-     *
-     * @param anchor not null
-     * @param name not null
-     */
-    // TODO Remove me when MSHARED-390 has been resolved
-    protected void startSection( String anchor, String name )
-    {
-        section = section + 1;
-
-        super.sink.anchor( HtmlTools.encodeId( anchor ) );
-        super.sink.anchor_();
-
-        switch ( section )
-        {
-            case 1:
-                sink.section1();
-                sink.sectionTitle1();
-                break;
-            case 2:
-                sink.section2();
-                sink.sectionTitle2();
-                break;
-            case 3:
-                sink.section3();
-                sink.sectionTitle3();
-                break;
-            case 4:
-                sink.section4();
-                sink.sectionTitle4();
-                break;
-            case 5:
-                sink.section5();
-                sink.sectionTitle5();
-                break;
-
-            default:
-                // TODO: warning - just don't start a section
-                break;
-        }
-
-        text( name );
-
-        switch ( section )
-        {
-            case 1:
-                sink.sectionTitle1_();
-                break;
-            case 2:
-                sink.sectionTitle2_();
-                break;
-            case 3:
-                sink.sectionTitle3_();
-                break;
-            case 4:
-                sink.sectionTitle4_();
-                break;
-            case 5:
-                sink.sectionTitle5_();
-                break;
-
-            default:
-                // TODO: warning - just don't start a section
-                break;
-        }
-    }
-
-    /** {@inheritDoc} */
-    // workaround for MPIR-140
-    // TODO Remove me when MSHARED-390 has been resolved
-    @Override
-    protected void endSection()
-    {
-        switch ( section )
-        {
-            case 1:
-                sink.section1_();
-                break;
-            case 2:
-                sink.section2_();
-                break;
-            case 3:
-                sink.section3_();
-                break;
-            case 4:
-                sink.section4_();
-                break;
-            case 5:
-                sink.section5_();
-                break;
-
-            default:
-                // TODO: warning - just don't start a section
-                break;
-        }
-
-        section = section - 1;
-
-        if ( section < 0 )
-        {
-            throw new IllegalStateException( "Too many closing sections" );
-        }
-    }
-
     // ----------------------------------------------------------------------
     // Private methods
     // ----------------------------------------------------------------------
@@ -742,7 +618,7 @@ public class DependenciesRenderer
             String anchorByScope =
                 ( isTransitive ? getI18nString( "transitive.title" ) + "_" + scope : getI18nString( "title" ) + "_"
                     + scope );
-            startSection( anchorByScope, scope );
+            startSection( scope, anchorByScope );
 
             paragraph( getI18nString( "intro." + scope ) );
 
@@ -910,8 +786,7 @@ public class DependenciesRenderer
 
                 List<License> licenses = artifactProject.getLicenses();
 
-                sink.table();
-                sink.tableRows( null, false );
+                startTable( null, false );
 
                 sink.tableRow();
                 sink.tableHeaderCell();
@@ -1008,8 +883,7 @@ public class DependenciesRenderer
                 sink.tableCell_();
                 sink.tableRow_();
 
-                sink.tableRows_();
-                sink.table_();
+                endTable();
             }
             catch ( ProjectBuildingException e )
             {
@@ -1028,8 +902,7 @@ public class DependenciesRenderer
         }
         else
         {
-            sink.table();
-            sink.tableRows( null, false );
+            startTable( null, false );
 
             sink.tableRow();
             sink.tableHeaderCell();
@@ -1060,8 +933,7 @@ public class DependenciesRenderer
             sink.tableCell_();
             sink.tableRow_();
 
-            sink.tableRows_();
-            sink.table_();
+            endTable();
         }
 
         sink.rawText( "</div>" );
diff --git a/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java b/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java
index 4ae02ca..fdf8f13 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java
@@ -21,8 +21,8 @@ package org.apache.maven.report.projectinfo;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Locale;
 
+import org.apache.maven.doxia.tools.SiteTool;
 import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.ArtifactStubFactory;
@@ -38,6 +38,8 @@ import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
 import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.repository.LocalRepository;
 
+import com.meterware.httpunit.HttpUnitOptions;
+
 /**
  * Abstract class to test reports generation with <a href="http://www.httpunit.org/">HTTPUnit</a> framework.
  *
@@ -50,11 +52,6 @@ public abstract class AbstractProjectInfoTestCase
 {
     private ArtifactStubFactory artifactStubFactory;
 
-    /**
-     * The default locale is English.
-     */
-    protected static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
-
     /**
      * The current project to be test.
      */
@@ -72,14 +69,13 @@ public abstract class AbstractProjectInfoTestCase
         // required for mojo lookups to work
         super.setUp();
 
+        HttpUnitOptions.setScriptingEnabled( false );
+
         i18n = getContainer().lookup( I18N.class );
         setVariableValueToObject( i18n, "defaultBundleName", "project-info-reports" );
 
         artifactStubFactory = new DependencyArtifactStubFactory( getTestFile( "target" ), true, false );
         artifactStubFactory.getWorkingDir().mkdirs();
-
-        // Set the default Locale
-        Locale.setDefault( DEFAULT_LOCALE );
     }
 
     @Override
@@ -102,7 +98,7 @@ public abstract class AbstractProjectInfoTestCase
             throw new IllegalArgumentException( "The key cannot be empty" );
         }
 
-        return i18n.getString( key, Locale.getDefault() ).trim();
+        return i18n.getString( key, SiteTool.DEFAULT_LOCALE ).trim();
     }
 
     /**
diff --git a/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java
index 2a96e15..ef20784 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java
@@ -20,7 +20,6 @@ package org.apache.maven.report.projectinfo;
  */
 
 import java.net.URL;
-import java.util.Locale;
 
 import com.meterware.httpunit.GetMethodWebRequest;
 import com.meterware.httpunit.TextBlock;
@@ -97,19 +96,8 @@ public class MailingListsReportTest
     public void testFrenchReport()
         throws Exception
     {
-        Locale oldLocale = Locale.getDefault();
-
-        try
-        {
-            Locale.setDefault( Locale.FRENCH );
-
-            generateReport( "mailing-lists", "mailing-lists-plugin-config.xml" );
-            assertTrue( "Test html generated", getGeneratedReport( "mailing-lists.html" ).exists() );
-        }
-        finally
-        {
-            Locale.setDefault( oldLocale );
-        }
+        generateReport( "mailing-lists", "mailing-lists-plugin-config-fr.xml" );
+        assertTrue( "Test html generated", getGeneratedReport( "mailing-lists.html" ).exists() );
     }
 
     /**
diff --git a/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java
index 7a1463a..a90106c 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java
@@ -87,7 +87,8 @@ public class ModulesReportTest
 
         // Test the texts
         TextBlock[] textBlocks = response.getTextBlocks();
-        assertEquals( 2, textBlocks.length );
+        // Last one is footer noise
+        assertEquals( 2, textBlocks.length - 1 );
         assertEquals( getString( "report.modules.title" ), textBlocks[0].getText() );
         assertEquals( getString( "report.modules.intro" ), textBlocks[1].getText() );
 
diff --git a/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java
index 6f23220..49504ec 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java
@@ -72,7 +72,8 @@ public class ScmReportTest
 
         // Test the texts
         TextBlock[] textBlocks = response.getTextBlocks();
-        assertEquals( 6, textBlocks.length );
+        // Last one is footer noise
+        assertEquals( 6, textBlocks.length - 1 );
         assertEquals( getString( "report.scm.overview.title" ), textBlocks[0].getText() );
         assertEquals( getString( "report.scm.general.intro" ), textBlocks[1].getText() );
         assertEquals( getString( "report.scm.webaccess.title" ), textBlocks[2].getText() );
diff --git a/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java
index 82d2c4d..e45272e 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java
@@ -78,7 +78,8 @@ public class TeamReportTest
 
         // Test the texts
         TextBlock[] textBlocks = response.getTextBlocks();
-        assertEquals( 7, textBlocks.length );
+        // Last one is footer noise
+        assertEquals( 7, textBlocks.length - 1 );
         assertEquals( getString( "report.team.intro.title" ), textBlocks[0].getText() );
         assertEquals( getString( "report.team.intro.description1" ), textBlocks[1].getText() );
         assertEquals( getString( "report.team.intro.description2" ), textBlocks[2].getText() );
diff --git a/src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml b/src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml
new file mode 100644
index 0000000..96f4226
--- /dev/null
+++ b/src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml
@@ -0,0 +1,61 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugin.projectinfo.tests</groupId>
+  <artifactId>mailing-lists</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>mailing lists project info</name>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <mailingLists>
+    <mailingList>
+      <name>Test List</name>
+      <post>test@maven.apache.org</post>
+      <subscribe>MAILTO:test-subscribe@maven.apache.org</subscribe>
+    </mailingList>
+    <mailingList>
+      <name>Test List 2</name>
+      <post>test2@maven.apache.org</post>
+      <subscribe>MAILTO:test-subscribe2@maven.apache.org</subscribe>
+      <unsubscribe>https://example.com/unsubscribe</unsubscribe>
+    </mailingList>
+  </mailingLists>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <configuration>
+          <outputDirectory>target/test-harness/mailing-lists</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
+          <locale>fr</locale>
+          <project implementation="org.apache.maven.report.projectinfo.stubs.MailingListsStub"/>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>