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 a28d16b59ca1e75328dfd212a84c54c1e80a57da Author: Michael Osipov <micha...@apache.org> AuthorDate: Sat Jul 2 23:58:47 2022 +0200 Prepare for Doxia 2.0.0 --- pom.xml | 54 +++---------------- 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 + .../projectinfo/DependencyConvergenceReport.java | 9 ++++ .../renderer/DependenciesRenderer.java | 7 ++- .../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 ++++++++++++++++++++++ 15 files changed, 118 insertions(+), 96 deletions(-) diff --git a/pom.xml b/pom.xml index 2d9a136..1d41e5b 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.2-SNAPSHOT</version> + <version>4.0.0-SNAPSHOT</version> <packaging>maven-plugin</packaging> <name>Apache Maven Project Info Reports Plugin</name> @@ -119,12 +119,12 @@ under the License. <properties> <javaVersion>8</javaVersion> - <doxiaVersion>1.11.1</doxiaVersion> - <doxia-sitetoolsVersion>1.11.1</doxia-sitetoolsVersion> + <doxiaVersion>2.0.0-M4</doxiaVersion> + <doxiaSitetoolsVersion>2.0.0-M4</doxiaSitetoolsVersion> <mavenVersion>3.2.5</mavenVersion> <scmVersion>1.13.0</scmVersion> <aetherVersion>1.0.0.v20140518</aetherVersion> - <sitePluginVersion>3.12.1</sitePluginVersion> + <sitePluginVersion>4.0.0-M4</sitePluginVersion> <fluidoSkinVersion>1.11.1</fluidoSkinVersion> <surefire.version>2.22.2</surefire.version> <checkstyle.violation.ignore>ParameterNumber,MethodLength</checkstyle.violation.ignore> @@ -135,12 +135,12 @@ under the License. <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-api</artifactId> - <version>3.1.1</version> + <version>4.0.0-M3</version> </dependency> <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-impl</artifactId> - <version>3.2.0</version> + <version>4.0.0-M3</version> <exclusions> <exclusion> <groupId>org.apache.maven</groupId> @@ -326,56 +326,18 @@ under the License. <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-sink-api</artifactId> <version>${doxiaVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-core</artifactId> <version>${doxiaVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> </dependency> <!-- Doxia Sitetools --> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-decoration-model</artifactId> - <version>${doxia-sitetoolsVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-site-renderer</artifactId> - <version>${doxia-sitetoolsVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-api</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-integration-tools</artifactId> - <version>${doxia-sitetoolsVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> + <version>${doxiaSitetoolsVersion}</version> </dependency> <!-- Plexus --> @@ -393,7 +355,7 @@ under the License. <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> - <version>3.4.2</version> + <version>3.5.0</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> 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/DependencyConvergenceReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java index a04f8d6..cefe5cf 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java @@ -300,6 +300,7 @@ public class DependencyConvergenceReport private void generateDependencyDetails( Locale locale, Sink sink, List<ReverseDependencyLink> depList ) { sink.table(); + sink.tableRows( null, false ); Map<String, List<ReverseDependencyLink>> artifactMap = getSortedUniqueArtifactMap( depList ); @@ -314,6 +315,7 @@ public class DependencyConvergenceReport sink.tableCell(); sink.table(); + sink.tableRows( null, false ); for ( String version : artifactMap.keySet() ) { @@ -328,11 +330,14 @@ public class DependencyConvergenceReport sink.tableRow_(); } + sink.tableRows_(); sink.table_(); + sink.tableCell_(); sink.tableRow_(); + sink.tableRows_(); sink.table_(); } @@ -518,6 +523,7 @@ public class DependencyConvergenceReport private void generateLegend( Locale locale, Sink sink ) { sink.table(); + sink.tableRows( null, false ); sink.tableCaption(); sink.bold(); sink.text( getI18nString( locale, "legend" ) ); @@ -535,6 +541,7 @@ public class DependencyConvergenceReport sink.tableRow_(); + sink.tableRows_(); sink.table_(); } @@ -557,6 +564,7 @@ public class DependencyConvergenceReport // Create report sink.table(); + sink.tableRows( null, false ); sink.tableCaption(); sink.bold(); sink.text( getI18nString( locale, "stats.caption" ) ); @@ -665,6 +673,7 @@ public class DependencyConvergenceReport sink.tableCell_(); sink.tableRow_(); + sink.tableRows_(); sink.table_(); } 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 43eb156..02f848a 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 @@ -857,7 +857,7 @@ public class DependenciesRenderer String javascript = String.format( "<img id=\"%s\" src=\"%s\" alt=\"%s\"" + " onclick=\"toggleDependencyDetails( '%s', '%s' );\"" - + " style=\"cursor: pointer; vertical-align: text-bottom;\"></img>", + + " style=\"cursor: pointer; vertical-align: text-bottom;\" />", imgId, IMG_INFO_URL, getI18nString( "graph.icon.information" ), dependencyDetailId, imgId ); sink.rawText( javascript ); @@ -911,6 +911,7 @@ public class DependenciesRenderer List<License> licenses = artifactProject.getLicenses(); sink.table(); + sink.tableRows( null, false ); sink.tableRow(); sink.tableHeaderCell(); @@ -1007,10 +1008,12 @@ public class DependenciesRenderer sink.tableCell_(); sink.tableRow_(); + sink.tableRows_(); sink.table_(); } catch ( ProjectBuildingException e ) { + sink.text( getI18nString( "index", "nodescription" ) ); if ( log.isDebugEnabled() ) { log.debug( "Unable to create Maven project from repository for artifact '" @@ -1026,6 +1029,7 @@ public class DependenciesRenderer else { sink.table(); + sink.tableRows( null, false ); sink.tableRow(); sink.tableHeaderCell(); @@ -1056,6 +1060,7 @@ public class DependenciesRenderer sink.tableCell_(); sink.tableRow_(); + sink.tableRows_(); sink.table_(); } 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>t...@maven.apache.org</post> + <subscribe>MAILTO:test-subscr...@maven.apache.org</subscribe> + </mailingList> + <mailingList> + <name>Test List 2</name> + <post>te...@maven.apache.org</post> + <subscribe>MAILTO:test-subscri...@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>