From 313fd4bbf1856b88796e6f86c3b552ac7d3bca01 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Mon, 7 Feb 2022 21:54:37 +0100 Subject: [PATCH 01/14] [maven-release-plugin] prepare for next development iteration --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a8c62d3a6..8c53e9036 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ under the License. maven-javadoc-plugin - 3.3.2 + 3.3.3-SNAPSHOT maven-plugin Apache Maven Javadoc Plugin @@ -48,7 +48,7 @@ under the License. scm:git:https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git https://github.com/apache/maven-javadoc-plugin/tree/${project.scm.tag} - maven-javadoc-plugin-3.3.2 + HEAD jira @@ -77,7 +77,7 @@ under the License. 3.3 2.7 - 2022-02-07T20:52:42Z + 2022-02-07T20:54:37Z 1.7.32 From 3ce0357670568ea5e44f6ab8beffe34ae568a8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Mon, 28 Mar 2022 10:51:11 +0200 Subject: [PATCH 02/14] (doc) Update plugin' configuration parameter (MJAVADOC-475) --- src/it/projects/examples/alternate-doclet/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/it/projects/examples/alternate-doclet/pom.xml b/src/it/projects/examples/alternate-doclet/pom.xml index c477ce059..813b185a9 100644 --- a/src/it/projects/examples/alternate-doclet/pom.xml +++ b/src/it/projects/examples/alternate-doclet/pom.xml @@ -47,7 +47,7 @@ umlgraph 5.6.6 - -views + -views From 80e2646e21061bae11c268a9b1656824e4b15ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Mon, 28 Mar 2022 15:58:39 +0200 Subject: [PATCH 03/14] (doc) Update plugin' configuration parameter (MJAVADOC-475) --- src/it/projects/examples/alternate-doclet/pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/it/projects/examples/alternate-doclet/pom.xml b/src/it/projects/examples/alternate-doclet/pom.xml index 813b185a9..14489186f 100644 --- a/src/it/projects/examples/alternate-doclet/pom.xml +++ b/src/it/projects/examples/alternate-doclet/pom.xml @@ -47,7 +47,9 @@ umlgraph 5.6.6 - -views + + + From 3ba873cfae3677e9a37a864503802e9ae5c1e0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20=C5=BBygie=C5=82o?= Date: Wed, 30 Mar 2022 19:00:38 +0200 Subject: [PATCH 04/14] (doc) Fix spurious Javadoc @param tag --- .../org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java index 6fde43e8e..709a2dc9d 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -4670,7 +4670,7 @@ private List getPackageNames( Map> sourcePaths } /** - * @param allSourcePaths not null, containing absolute and relative paths + * @param javadocModules not null * @return a list of exported package names for files in allSourcePaths * @throws MavenReportException if any * @see #getFiles From 9dd7bddb3db6d0d230092d7fbbd4188a98a3a75e Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sat, 9 Apr 2022 19:58:40 +1000 Subject: [PATCH 05/14] use shared gh action/release-drafter (#128) * use shared gh action/release-drafter * add release drafter configuration * add release-drafter action --- .github/release-drafter.yml | 19 +++++++++++++++ .github/workflows/maven.yml | 34 +++++++-------------------- .github/workflows/release-drafter.yml | 25 ++++++++++++++++++++ 3 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 000000000..7da033fff --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,19 @@ +# 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. + +_extends: maven-gh-actions-shared +tag-template: maven-javadoc-plugin-$NEXT_MINOR_VERSION diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index e66eb0fe0..e5c93cb77 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,32 +15,16 @@ # specific language governing permissions and limitations # under the License. -name: GitHub CI +name: Verify -on: [push, pull_request] +on: + push: + pull_request: jobs: build: - - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - java: [8, 11, 17] - jdk: [temurin, zulu] - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: ${{ matrix.jdk }} - java-version: ${{ matrix.java }} - cache: 'maven' - - - name: Build with Maven - run: mvn verify site --errors --batch-mode --show-version -P run-its + name: Verify + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2 + with: + jdk-distribution-matrix: '[ "temurin", "zulu", "microsoft", "liberica", "adopt-openj9" ]' + matrix-exclude: '[{ "jdk": "8", "distribution": "microsoft"}]' diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..58e5ee492 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,25 @@ +# 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. + +name: Release Drafter +on: + push: + branches: + - master +jobs: + update_release_draft: + uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v2 From 2583554135dc04db58a435ebcbd2cd19f0d2563a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Apr 2022 10:01:03 +0000 Subject: [PATCH 06/14] Bump commons-io from 2.2 to 2.7 in /src/it/projects/MJAVADOC-437/module2 Bumps commons-io from 2.2 to 2.7. --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- src/it/projects/MJAVADOC-437/module2/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/it/projects/MJAVADOC-437/module2/pom.xml b/src/it/projects/MJAVADOC-437/module2/pom.xml index 24cd91a12..e07a7aa48 100644 --- a/src/it/projects/MJAVADOC-437/module2/pom.xml +++ b/src/it/projects/MJAVADOC-437/module2/pom.xml @@ -43,7 +43,7 @@ commons-io commons-io - 2.2 + 2.7 From ca00601609903a0e88a067b2aa3d49e88191937a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Apr 2022 09:59:06 +0000 Subject: [PATCH 07/14] Bump junit in /src/it/projects/MJAVADOC-498_modulepath Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md) - [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1) --- updated-dependencies: - dependency-name: junit:junit dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- src/it/projects/MJAVADOC-498_modulepath/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/it/projects/MJAVADOC-498_modulepath/pom.xml b/src/it/projects/MJAVADOC-498_modulepath/pom.xml index a97ea3485..ed338a0f4 100644 --- a/src/it/projects/MJAVADOC-498_modulepath/pom.xml +++ b/src/it/projects/MJAVADOC-498_modulepath/pom.xml @@ -42,7 +42,7 @@ junit junit - 4.12 + 4.13.1 test From 5dcfa6e70795d0b5cf5414a848e7e0aeb5541413 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Apr 2022 10:07:19 +0000 Subject: [PATCH 08/14] Bump plexus-archiver from 4.2.6 to 4.2.7 Bumps [plexus-archiver](https://github.com/codehaus-plexus/plexus-archiver) from 4.2.6 to 4.2.7. - [Release notes](https://github.com/codehaus-plexus/plexus-archiver/releases) - [Changelog](https://github.com/codehaus-plexus/plexus-archiver/blob/master/ReleaseNotes.md) - [Commits](https://github.com/codehaus-plexus/plexus-archiver/compare/plexus-archiver-4.2.6...plexus-archiver-4.2.7) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus-archiver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8c53e9036..ab33d0b7a 100644 --- a/pom.xml +++ b/pom.xml @@ -288,7 +288,7 @@ under the License. org.codehaus.plexus plexus-archiver - 4.2.6 + 4.2.7 org.codehaus.plexus From 03ca84372ab689c91dd0d5b63cc2ee12ee3c466b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Apr 2022 10:07:08 +0000 Subject: [PATCH 09/14] Bump maven-archiver from 3.5.1 to 3.5.2 Bumps [maven-archiver](https://github.com/apache/maven-archiver) from 3.5.1 to 3.5.2. - [Release notes](https://github.com/apache/maven-archiver/releases) - [Commits](https://github.com/apache/maven-archiver/compare/maven-archiver-3.5.1...maven-archiver-3.5.2) --- updated-dependencies: - dependency-name: org.apache.maven:maven-archiver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ab33d0b7a..df5de51e3 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,7 @@ under the License. org.apache.maven maven-archiver - 3.5.1 + 3.5.2 org.apache.maven.shared From 5fae3b656e131fa233982eebf0944b5253fc845e Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Fri, 15 Apr 2022 19:22:22 +0200 Subject: [PATCH 10/14] [MJAVADOC-711] Upgrade plugins in ITs --- pom.xml | 4 ++-- src/it/projects/MJAVADOC-134_multiaggregate/pom.xml | 2 +- src/it/projects/MJAVADOC-613-aggregate-exclude/pom.xml | 2 +- src/it/projects/MJAVADOC-636-aggregate_module_skipped/pom.xml | 2 +- src/it/projects/site-failOnError/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index df5de51e3..5d520501f 100644 --- a/pom.xml +++ b/pom.xml @@ -75,8 +75,8 @@ under the License. 1.1.0 9.4.43.v20210629 - 3.3 - 2.7 + 3.11.0 + 3.2.2 2022-02-07T20:54:37Z 1.7.32 diff --git a/src/it/projects/MJAVADOC-134_multiaggregate/pom.xml b/src/it/projects/MJAVADOC-134_multiaggregate/pom.xml index 617610684..2a277b722 100644 --- a/src/it/projects/MJAVADOC-134_multiaggregate/pom.xml +++ b/src/it/projects/MJAVADOC-134_multiaggregate/pom.xml @@ -74,7 +74,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.9 + @projectInfoReportsPluginVersion@ diff --git a/src/it/projects/MJAVADOC-613-aggregate-exclude/pom.xml b/src/it/projects/MJAVADOC-613-aggregate-exclude/pom.xml index 0f305e864..522e1025e 100644 --- a/src/it/projects/MJAVADOC-613-aggregate-exclude/pom.xml +++ b/src/it/projects/MJAVADOC-613-aggregate-exclude/pom.xml @@ -74,7 +74,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.9 + @projectInfoReportsPluginVersion@ diff --git a/src/it/projects/MJAVADOC-636-aggregate_module_skipped/pom.xml b/src/it/projects/MJAVADOC-636-aggregate_module_skipped/pom.xml index fd62f9384..d8a280ba9 100644 --- a/src/it/projects/MJAVADOC-636-aggregate_module_skipped/pom.xml +++ b/src/it/projects/MJAVADOC-636-aggregate_module_skipped/pom.xml @@ -77,7 +77,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.9 + @projectInfoReportsPluginVersion@ diff --git a/src/it/projects/site-failOnError/pom.xml b/src/it/projects/site-failOnError/pom.xml index 7ad483831..cd98ff650 100644 --- a/src/it/projects/site-failOnError/pom.xml +++ b/src/it/projects/site-failOnError/pom.xml @@ -71,7 +71,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.9 + @projectInfoReportsPluginVersion@ From 47d03d3a08cc58a93fa384f4661d79c350842b82 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Fri, 15 Apr 2022 20:01:49 +0200 Subject: [PATCH 11/14] [MJAVADOC-712] Remove remains of org.codehaus.doxia.sink.Sink --- .../org/apache/maven/plugins/javadoc/JavadocReport.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java index 98328391d..7be50290e 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java @@ -123,12 +123,6 @@ public String getDescription( Locale locale ) return description; } - public void generate( org.codehaus.doxia.sink.Sink sink, Locale locale ) - throws MavenReportException - { - generate( (Sink) sink, locale ); - } - /** {@inheritDoc} */ @Override public void generate( Sink sink, Locale locale ) From 506cb74e6abc4b108121b0c586a15b75dd5ccc39 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 16 Apr 2022 17:23:44 +0200 Subject: [PATCH 12/14] [MJAVADOC-696] Invalid anchors in Javadoc and plugin mojo --- .../plugins/javadoc/AbstractJavadocMojo.java | 123 ++++++++---------- 1 file changed, 56 insertions(+), 67 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java index 709a2dc9d..a26d19cd5 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -539,7 +539,7 @@ public abstract class AbstractJavadocMojo /** * Detect the links for all modules defined in the project. *
- * If {@link #reactorProjects} is defined in a non-aggregator way, it generates default offline links + * If {@code reactorProjects} is defined in a non-aggregator way, it generates default offline links * between modules based on the defined project's urls. For instance, if a parent project has two projects * module1 and module2, the -linkoffline will be: *
@@ -562,12 +562,7 @@ public abstract class AbstractJavadocMojo * By default, the goal detects the Javadoc API link depending the value of the source * parameter in the org.apache.maven.plugins:maven-compiler-plugin * (defined in ${project.build.plugins} or in ${project.build.pluginManagement}), - * or try to compute it from the {@link #javadocExecutable} version. - *
- * See - * Javadoc - * for the default values. - *
+ * or try to compute it from the {@code javadocExecutable} version. * * @see #links * @see #javaApiLinks @@ -1132,7 +1127,7 @@ public abstract class AbstractJavadocMojo *
* Notes: *
    - *
  1. only used if {@link #isOffline} is set to false.
  2. + *
  3. only used if {@code isOffline} is set to false.
  4. *
  5. all given links should have a fetchable /package-list file. For instance: *
          * <links>
    @@ -1140,35 +1135,31 @@ public abstract class AbstractJavadocMojo
          * <links>
          * 
    * will be used because https://docs.oracle.com/javase/1.4.2/docs/api/package-list exists.
  6. - *
  7. if {@link #detectLinks} is defined, the links between the project dependencies are + *
  8. if {@code detectLinks} is defined, the links between the project dependencies are * automatically added.
  9. - *
  10. if {@link #detectJavaApiLink} is defined, a Java API link, based on the Java version of the + *
  11. if {@code detectJavaApiLink} is defined, a Java API link, based on the Java version of the * project's sources, will be added automatically.
  12. *
* See link. - * - * @see #detectLinks - * @see #detectJavaApiLink - * @see #dependencyLinks */ @Parameter( property = "links" ) protected ArrayList links; - + /** - * Redefine the apidoc URL for specific dependencies when using {@link #detectLinks}. + * Redefine the apidoc URL for specific dependencies when using {@code detectLinks}. * Useful if the dependency wasn't build with Maven or when the apidocs have been moved. *
      * <dependencyLinks>
      *   <dependencyLink>
      *     <groupId>groupId</groupId>
      *     <artifactId>artifactId</artifactId>
-     *     <classifier>classifier</classifier> <!-- optional --> 
+     *     <classifier>classifier</classifier> <!-- optional -->
      *     <url>version</url>
      *   </dependencyLink>
      * </dependencyLinks>
      * 
- * + * * @see #detectLinks * @since 3.3.0 */ @@ -1334,7 +1325,7 @@ public abstract class AbstractJavadocMojo * </offlineLinks> * *
- * Note: if {@link #detectOfflineLinks} is defined, the offline links between the project modules are + * Note: if {@code detectOfflineLinks} is defined, the offline links between the project modules are * automatically added if the goal is calling in a non-aggregator way. *
* @see Javadoc. @@ -1454,9 +1445,9 @@ public abstract class AbstractJavadocMojo */ @Parameter( property = "stylesheetfile" ) private String stylesheetfile; - + /** - * Specifies the path of an additional HTML stylesheet file relative to the {@link #javadocDirectory} + * Specifies the path of an additional HTML stylesheet file relative to the {@code javadocDirectory} * Example: *
      *     <addStylesheets>
@@ -1467,7 +1458,7 @@ public abstract class AbstractJavadocMojo
      */
     @Parameter
     private String[] addStylesheets;
-    
+
     /**
      * Specifies the class file that starts the taglet used in generating the documentation for that tag.
      * 
@@ -1796,7 +1787,7 @@ public abstract class AbstractJavadocMojo * * } *
- * + * * note: requires at least Maven 3.3.1 * * @since 3.0.0 @@ -1893,7 +1884,7 @@ protected List getProjectBuildOutputDirs( MavenProject p ) /** * Either returns the attached artifact file or outputDirectory - * + * * @param project * @return */ @@ -1912,7 +1903,7 @@ protected File getClassesFile( MavenProject project ) return artifactFile; } } - else if ( project.getExecutionProject() != null + else if ( project.getExecutionProject() != null && project.getExecutionProject().getArtifact() != null && project.getExecutionProject().getArtifact().getFile() != null ) { @@ -1922,10 +1913,10 @@ else if ( project.getExecutionProject() != null return artifactFile; } } - + if ( project.getBuild().getOutputDirectory() != null ) { - return new File( project.getBuild().getOutputDirectory() ); + return new File( project.getBuild().getOutputDirectory() ); } else { @@ -2348,7 +2339,7 @@ protected Map> getFiles( Collection sourcePaths ) if ( StringUtils.isEmpty( subpackages ) ) { Collection excludedPackages = getExcludedPackages(); - + final boolean autoExclude; if ( release != null ) { @@ -2462,7 +2453,7 @@ protected Collection getSourcePaths() additionalSourcePaths.addAll( l ); } } - + if ( !additionalSourcePaths.isEmpty() ) { mappedSourcePaths.add( buildJavadocModule( subProject , additionalSourcePaths ) ); @@ -2487,7 +2478,7 @@ protected Collection getSourcePaths() getJavadocDirectory().getAbsolutePath() ) ); sourcePaths.addAll( l ); } - + if ( !sourcePaths.isEmpty() ) { mappedSourcePaths.add( new JavadocModule( ArtifactUtils.versionlessKey( project.getGroupId(), @@ -2499,7 +2490,7 @@ protected Collection getSourcePaths() return mappedSourcePaths; } - + private JavadocModule buildJavadocModule( MavenProject project, Collection sourcePaths ) { File classessFile = getClassesFile( project ); @@ -2507,14 +2498,14 @@ private JavadocModule buildJavadocModule( MavenProject project, Collection if ( resolvePathResult == null ) { return new JavadocModule( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ), - classessFile, + classessFile, sourcePaths ); } else { return new JavadocModule( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ), - classessFile, - sourcePaths, + classessFile, + sourcePaths, resolvePathResult.getModuleDescriptor(), resolvePathResult.getModuleNameSource() ); } @@ -2657,15 +2648,15 @@ private SourceResolverConfig getDependencySourceResolverConfig() andFilters.add( new PatternExclusionsFilter( dependencyExcludes ) ); } } - + return configureDependencySourceResolution( new SourceResolverConfig( project, getProjectBuildingRequest( project ), sourceDependencyCacheDir ) .withReactorProjects( this.reactorProjects ) ) .withFilter( new AndFilter( andFilters ) ); - + } - + private ProjectBuildingRequest getProjectBuildingRequest( MavenProject currentProject ) { return new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() ) @@ -3098,11 +3089,11 @@ private String getBottomText() /** * Method to get the stylesheet path file to be used by the Javadoc Tool. *
- * If the {@link #stylesheetfile} is empty, return the file as String definded by {@link #stylesheet} value. + * If the {@code stylesheetfile} is empty, return the file as String definded by {@code stylesheet} value. *
- * If the {@link #stylesheetfile} is defined, return the file as String. + * If the {@code stylesheetfile} is defined, return the file as String. *
- * Note: since 2.6, the {@link #stylesheetfile} could be a path from a resource in the project source + * Note: since 2.6, the {@code stylesheetfile} could be a path from a resource in the project source * directories (i.e. src/main/java, src/main/resources or src/main/javadoc) * or from a resource in the Javadoc plugin dependencies. * @@ -3131,18 +3122,18 @@ private Optional getStylesheetFile( final File javadocOutputDirectory ) return getResource( new File( javadocOutputDirectory, DEFAULT_CSS_NAME ), stylesheetfile ); } - + private void addAddStyleSheets( List arguments ) throws MavenReportException { if ( addStylesheets == null ) { return; } - + for ( String addStylesheet : addStylesheets ) { Optional styleSheet = getAddStylesheet( getJavadocDirectory(), addStylesheet ); - + if ( styleSheet.isPresent() ) { addArgIfNotEmpty( arguments, "--add-stylesheet", @@ -3151,8 +3142,8 @@ private void addAddStyleSheets( List arguments ) throws MavenReportExcep } } } - - + + private Optional getAddStylesheet( final File javadocOutputDirectory, final String stylesheet ) throws MavenReportException { @@ -3160,7 +3151,7 @@ private Optional getAddStylesheet( final File javadocOutputDirectory, fina { return Optional.empty(); } - + File addstylesheetfile = new File( getJavadocDirectory(), stylesheet ); if ( addstylesheetfile.exists() ) { @@ -3173,18 +3164,18 @@ private Optional getAddStylesheet( final File javadocOutputDirectory, fina + "than stylesheetfile: " + stylesheetfile.get().getName() ); } } - + return Optional.of( addstylesheetfile ); } - throw new MavenReportException( "additional stylesheet file does not exist: " + throw new MavenReportException( "additional stylesheet file does not exist: " + addstylesheetfile.getAbsolutePath() ); } /** * Method to get the help file to be used by the Javadoc Tool. *
- * Since 2.6, the {@link #helpfile} could be a path from a resource in the project source + * Since 2.6, the {@code helpfile} could be a path from a resource in the project source * directories (i.e. src/main/java, src/main/resources or src/main/javadoc) * or from a resource in the Javadoc plugin dependencies. * @@ -4324,10 +4315,10 @@ private void addArgIfNotEmpty( List arguments, String key, String value, } /** - * Convenience method to process {@link #offlineLinks} values as individual -linkoffline + * Convenience method to process {@code offlineLinks} values as individual -linkoffline * javadoc options. *
- * If {@link #detectOfflineLinks}, try to add javadoc apidocs according Maven conventions for all modules given + * If {@code detectOfflineLinks}, try to add javadoc apidocs according Maven conventions for all modules given * in the project. * * @param arguments a list of arguments, not null @@ -4373,7 +4364,7 @@ private Set getLinkofflines() throws MavenReportException /** * Convenience method to process {@link #links} values as individual -link javadoc options. - * If {@link #detectLinks}, try to add javadoc apidocs according Maven conventions for all dependencies given + * If {@code detectLinks}, try to add javadoc apidocs according Maven conventions for all dependencies given * in the project. *
* According the Javadoc documentation, all defined link should have ${link}/package-list fetchable. @@ -4469,9 +4460,9 @@ private void copyAllResources( File javadocOutputDirectory ) } /** - * Copies the {@link #DEFAULT_CSS_NAME} css file from the current class - * loader to the outputDirectory only if {@link #stylesheetfile} is empty and - * {@link #stylesheet} is equals to maven. + * Copies the {@code DEFAULT_CSS_NAME} css file from the current class + * loader to the outputDirectory only if {@code stylesheetfile} is empty and + * {@code stylesheet} is equals to maven. * * @param anOutputDirectory the output directory * @throws java.io.IOException if any @@ -5168,7 +5159,7 @@ private void addJavadocOptions( File javadocOutputDirectory, Map allModuleDescriptors = new HashMap<>(); boolean supportModulePath = javadocRuntimeVersion.isAtLeast( "9" ); - if ( release != null ) + if ( release != null ) { supportModulePath &= JavaVersion.parse( release ).isAtLeast( "9" ); } @@ -5682,14 +5673,14 @@ private void addStandardDocletOptions( File javadocOutputDirectory, addArgIf( arguments, splitindex, "-splitindex" ); Optional stylesheetfile = getStylesheetFile( javadocOutputDirectory ); - + if ( stylesheetfile.isPresent() ) { addArgIfNotEmpty( arguments, "-stylesheetfile", JavadocUtil.quotedPathArgument( stylesheetfile.get().getAbsolutePath() ) ); } - - addAddStyleSheets( arguments ); + + addAddStyleSheets( arguments ); if ( StringUtils.isNotEmpty( sourcepath ) && !isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) { @@ -6348,7 +6339,7 @@ private String getFullJavadocGoal() { String javadocPluginVersion = null; String resource = "META-INF/maven/org.apache.maven.plugins/maven-javadoc-plugin/pom.properties"; - try ( InputStream resourceAsStream + try ( InputStream resourceAsStream = AbstractJavadocMojo.class.getClassLoader().getResourceAsStream( resource ) ) { if ( resourceAsStream != null ) @@ -6497,7 +6488,7 @@ private List getModulesLinks() * @return the detected Javadoc links using the Maven conventions for all dependencies defined in the current * project or an empty list. * @see #detectLinks - * @see #isValidJavadocLink + * @see #isValidJavadocLink(String, boolean) * @since 2.6 */ private List getDependenciesLinks() @@ -6521,7 +6512,7 @@ private List getDependenciesLinks() Optional depLink = this.dependencyLinks.stream().filter( d -> matches( d, artifact ) ).findAny(); - + final String url; final boolean detected; if ( depLink.isPresent() ) @@ -6545,7 +6536,7 @@ private List getDependenciesLinks() continue; } } - + if ( url != null && isValidJavadocLink( url, detected ) ) { getLog().debug( "Added Javadoc link: " + url + " for " + artifact.getId() ); @@ -6575,13 +6566,11 @@ private boolean matches( DependencyLink d, Artifact artifact ) } /** - * @return if {@link #detectJavaApiLink}, the Java API link based on the {@link #javaApiLinks} properties and the + * @return if {@code detectJavaApiLink}, the Java API link based on the {@code javaApiLinks} properties and the * value of the source parameter in the * org.apache.maven.plugins:maven-compiler-plugin * defined in ${project.build.plugins} or in ${project.build.pluginManagement}, - * or the {@link #javadocRuntimeVersion}, or null if not defined. - * @see #detectJavaApiLink - * @see #javaApiLinks + * or the {@code javadocRuntimeVersion}, or null if not defined. * @see source parameter * @since 2.6 */ From 0c6b32fb5ec9c31b4e38d9f32616ff51102623da Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 16 Apr 2022 23:53:29 +0200 Subject: [PATCH 13/14] [MJAVADOC-714] Upgrade to Maven 3.2.5 This closes #134 --- pom.xml | 43 +- .../javadoc/AggregatorJavadocReportTest.java | 535 +++++++++--------- .../plugins/javadoc/JavadocReportTest.java | 49 +- .../tagletArtifacts-test-plugin-config.xml | 5 - 4 files changed, 309 insertions(+), 323 deletions(-) diff --git a/pom.xml b/pom.xml index 5d520501f..5f4a94e9d 100644 --- a/pom.xml +++ b/pom.xml @@ -67,11 +67,11 @@ under the License. 8 - 3.0 + 3.2.5 1.11.1 1.11.1 2.4 - 1.13.1 + 1.0.0.v20140518 1.1.0 9.4.43.v20210629 @@ -132,33 +132,33 @@ under the License. - org.sonatype.aether + org.eclipse.aether aether-api - ${sonatypeAetherVersion} + ${aetherVersion} - org.sonatype.aether - aether-connector - ${sonatypeAetherVersion} + org.eclipse.aether + aether-connector-basic + ${aetherVersion} - org.sonatype.aether - aether-connector-wagon - ${sonatypeAetherVersion} + org.eclipse.aether + aether-transport-wagon + ${aetherVersion} - org.sonatype.aether + org.eclipse.aether aether-impl - ${sonatypeAetherVersion} + ${aetherVersion} - org.sonatype.aether + org.eclipse.aether aether-util - ${sonatypeAetherVersion} + ${aetherVersion} - + org.apache.maven @@ -331,7 +331,7 @@ under the License. org.apache.maven.plugin-testing maven-plugin-testing-harness - 2.1 + 3.3.0 test @@ -365,8 +365,13 @@ under the License. test - org.sonatype.aether - aether-connector-wagon + org.eclipse.aether + aether-connector-basic + test + + + org.eclipse.aether + aether-transport-wagon test @@ -468,7 +473,7 @@ under the License. ${maven.home} ${https.protocols} - + true diff --git a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java index 7f58c9de4..338bdc23b 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java @@ -1,267 +1,268 @@ -package org.apache.maven.plugins.javadoc; - -/* - * 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. - */ - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.List; -import java.util.Locale; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.testing.AbstractMojoTestCase; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.languages.java.version.JavaVersion; -import org.codehaus.plexus.util.FileUtils; -import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager; -import org.sonatype.aether.util.DefaultRepositorySystemSession; - -public class AggregatorJavadocReportTest - extends AbstractMojoTestCase -{ - private static final char LINE_SEPARATOR = ' '; - - /** flag to copy repo only one time */ - private static boolean TEST_REPO_CREATED = false; - - private File unit; - - private File localRepo; - - /** {@inheritDoc} */ - @Override - protected void setUp() - throws Exception - { - super.setUp(); - - unit = new File( getBasedir(), "src/test/resources/unit" ); - - localRepo = new File( getBasedir(), "target/local-repo/" ); - - createTestRepo(); - } - - private JavadocReport lookupMojo( File testPom ) - throws Exception - { - JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom ); - - MojoExecution mojoExec = new MojoExecution( new Plugin(), "aggregate", null ); - setVariableValueToObject( mojo, "mojo", mojoExec ); - - MavenProject currentProject = new MavenProjectStub(); - currentProject.setGroupId( "GROUPID" ); - currentProject.setArtifactId( "ARTIFACTID" ); - - MavenSession session = newMavenSession( currentProject ); - DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession(); - repoSysSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); - setVariableValueToObject( mojo, "session", session ); - - return mojo; - } - - /** - * Create test repository in target directory. - * - * @throws IOException if any - */ - private void createTestRepo() - throws IOException - { - if ( TEST_REPO_CREATED ) - { - return; - } - - localRepo.mkdirs(); - - // ---------------------------------------------------------------------- - // UMLGraph - // ---------------------------------------------------------------------- - - File sourceDir = new File( unit, "doclet-test/artifact-doclet" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // UMLGraph-bis - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "doclet-path-test/artifact-doclet" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // commons-attributes-compiler - // http://www.tullmann.org/pat/taglets/ - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "taglet-test/artifact-taglet" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // stylesheetfile-test - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "stylesheetfile-test/artifact-stylesheetfile" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // helpfile-test - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "helpfile-test/artifact-helpfile" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // Remove SCM files - List files = FileUtils.getFileAndDirectoryNames( localRepo, FileUtils.getDefaultExcludesAsString(), - null, true, true, true, true ); - for ( String filename : files ) - { - File file = new File( filename ); - - if ( file.isDirectory() ) - { - FileUtils.deleteDirectory( file ); - } - else - { - file.delete(); - } - } - - TEST_REPO_CREATED = true; - } - - /** - * Convenience method that reads the contents of the specified file object into a string with a space - * as line separator. - * - * @see #LINE_SEPARATOR - * @param file the file to be read - * @return a String object that contains the contents of the file - * @throws IOException if any - */ - private static String readFile( File file ) - throws IOException - { - StringBuilder str = new StringBuilder( (int) file.length() ); - - try (BufferedReader in = new BufferedReader(new FileReader(file))) { - - for ( String strTmp ; ( strTmp = in.readLine() ) != null ; ) { - str.append( LINE_SEPARATOR ); - str.append( strTmp ); - } - } - - return str.toString(); - } - - /** - * Method to test the aggregate parameter - * - * @throws Exception if any - */ - public void testAggregate() - throws Exception - { - File testPom = new File( unit, "aggregate-test/aggregate-test-plugin-config.xml" ); - JavadocReport mojo = lookupMojo( testPom ); - mojo.execute(); - - File apidocs = new File( getBasedir(), "target/test/unit/aggregate-test/target/site/apidocs/" ); - - // check if project1 api files exist - assertTrue( new File( apidocs, "aggregate/test/project1/Project1App.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project1/Project1AppSample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project1/Project1Sample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project1/Project1Test.html" ).exists() ); - - // check if project2 api files exist - assertTrue( new File( apidocs, "aggregate/test/project2/Project2App.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project2/Project2AppSample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project2/Project2Sample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project2/Project2Test.html" ).exists() ); - } - - /** - * Test the javadoc resources in the aggregation case. - * - * @throws Exception if any - */ - public void testAggregateJavadocResources() - throws Exception - { - File testPom = new File( unit, "aggregate-resources-test/aggregate-resources-test-plugin-config.xml" ); - JavadocReport mojo = lookupMojo( testPom ); - mojo.execute(); - - File apidocs = new File( getBasedir(), "target/test/unit/aggregate-resources-test/target/site/apidocs" ); - - // Test overview - File overviewSummary = getOverviewSummary(apidocs); - - assertTrue( overviewSummary.exists() ); - String overview = readFile( overviewSummary ).toLowerCase( Locale.ENGLISH ); - assertTrue( overview.contains( "resources.test" ) ); - assertTrue( overview.contains( ">blablaresources.test2" ) ); - assertTrue( overview.contains( "resources2.test" ) ); - assertTrue( overview.contains( "resources2.test2" ) ); - - // Test doc-files - File app = new File( apidocs, "resources/test/App.html" ); - assertTrue( app.exists() ); - overview = readFile( app ); - assertTrue( overview.contains( "\"Maven\"" ) ); - assertTrue( new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() ); - } - - public void testAggregateWithModulsNotInSubFolders() throws Exception - { - File testPom = new File( unit, "aggregate-modules-not-in-subfolders-test/all/pom.xml"); - JavadocReport mojo = lookupMojo( testPom ); - mojo.execute(); - - File apidocs = new File( getBasedir(), "target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs" ); - assertTrue( apidocs.isDirectory() ); - assertTrue( getOverviewSummary( apidocs ).isFile() ); - } - - private static File getOverviewSummary(File apidocs) - { - if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) ) - { - return new File( apidocs, "overview-summary.html" ); - } - return new File( apidocs, "index.html" ); - } - -} +package org.apache.maven.plugins.javadoc; + +/* + * 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. + */ + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.List; +import java.util.Locale; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Plugin; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.languages.java.version.JavaVersion; +import org.codehaus.plexus.util.FileUtils; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; +import org.eclipse.aether.repository.LocalRepository; + +public class AggregatorJavadocReportTest + extends AbstractMojoTestCase +{ + private static final char LINE_SEPARATOR = ' '; + + /** flag to copy repo only one time */ + private static boolean TEST_REPO_CREATED = false; + + private File unit; + + private File localRepo; + + /** {@inheritDoc} */ + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + unit = new File( getBasedir(), "src/test/resources/unit" ); + + localRepo = new File( getBasedir(), "target/local-repo/" ); + + createTestRepo(); + } + + private JavadocReport lookupMojo( File testPom ) + throws Exception + { + JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom ); + + MojoExecution mojoExec = new MojoExecution( new Plugin(), "aggregate", null ); + setVariableValueToObject( mojo, "mojo", mojoExec ); + + MavenProject currentProject = new MavenProjectStub(); + currentProject.setGroupId( "GROUPID" ); + currentProject.setArtifactId( "ARTIFACTID" ); + + MavenSession session = newMavenSession( currentProject ); + DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession(); + repoSysSession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repoSysSession, new LocalRepository( localRepo ) ) ); + setVariableValueToObject( mojo, "session", session ); + + return mojo; + } + + /** + * Create test repository in target directory. + * + * @throws IOException if any + */ + private void createTestRepo() + throws IOException + { + if ( TEST_REPO_CREATED ) + { + return; + } + + localRepo.mkdirs(); + + // ---------------------------------------------------------------------- + // UMLGraph + // ---------------------------------------------------------------------- + + File sourceDir = new File( unit, "doclet-test/artifact-doclet" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // UMLGraph-bis + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "doclet-path-test/artifact-doclet" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // commons-attributes-compiler + // http://www.tullmann.org/pat/taglets/ + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "taglet-test/artifact-taglet" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // stylesheetfile-test + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "stylesheetfile-test/artifact-stylesheetfile" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // helpfile-test + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "helpfile-test/artifact-helpfile" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // Remove SCM files + List files = FileUtils.getFileAndDirectoryNames( localRepo, FileUtils.getDefaultExcludesAsString(), + null, true, true, true, true ); + for ( String filename : files ) + { + File file = new File( filename ); + + if ( file.isDirectory() ) + { + FileUtils.deleteDirectory( file ); + } + else + { + file.delete(); + } + } + + TEST_REPO_CREATED = true; + } + + /** + * Convenience method that reads the contents of the specified file object into a string with a space + * as line separator. + * + * @see #LINE_SEPARATOR + * @param file the file to be read + * @return a String object that contains the contents of the file + * @throws IOException if any + */ + private static String readFile( File file ) + throws IOException + { + StringBuilder str = new StringBuilder( (int) file.length() ); + + try (BufferedReader in = new BufferedReader(new FileReader(file))) { + + for ( String strTmp ; ( strTmp = in.readLine() ) != null ; ) { + str.append( LINE_SEPARATOR ); + str.append( strTmp ); + } + } + + return str.toString(); + } + + /** + * Method to test the aggregate parameter + * + * @throws Exception if any + */ + public void testAggregate() + throws Exception + { + File testPom = new File( unit, "aggregate-test/aggregate-test-plugin-config.xml" ); + JavadocReport mojo = lookupMojo( testPom ); + mojo.execute(); + + File apidocs = new File( getBasedir(), "target/test/unit/aggregate-test/target/site/apidocs/" ); + + // check if project1 api files exist + assertTrue( new File( apidocs, "aggregate/test/project1/Project1App.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project1/Project1AppSample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project1/Project1Sample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project1/Project1Test.html" ).exists() ); + + // check if project2 api files exist + assertTrue( new File( apidocs, "aggregate/test/project2/Project2App.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project2/Project2AppSample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project2/Project2Sample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project2/Project2Test.html" ).exists() ); + } + + /** + * Test the javadoc resources in the aggregation case. + * + * @throws Exception if any + */ + public void testAggregateJavadocResources() + throws Exception + { + File testPom = new File( unit, "aggregate-resources-test/aggregate-resources-test-plugin-config.xml" ); + JavadocReport mojo = lookupMojo( testPom ); + mojo.execute(); + + File apidocs = new File( getBasedir(), "target/test/unit/aggregate-resources-test/target/site/apidocs" ); + + // Test overview + File overviewSummary = getOverviewSummary(apidocs); + + assertTrue( overviewSummary.exists() ); + String overview = readFile( overviewSummary ).toLowerCase( Locale.ENGLISH ); + assertTrue( overview.contains( "resources.test" ) ); + assertTrue( overview.contains( ">blablaresources.test2" ) ); + assertTrue( overview.contains( "resources2.test" ) ); + assertTrue( overview.contains( "resources2.test2" ) ); + + // Test doc-files + File app = new File( apidocs, "resources/test/App.html" ); + assertTrue( app.exists() ); + overview = readFile( app ); + assertTrue( overview.contains( "\"Maven\"" ) ); + assertTrue( new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() ); + } + + public void testAggregateWithModulsNotInSubFolders() throws Exception + { + File testPom = new File( unit, "aggregate-modules-not-in-subfolders-test/all/pom.xml"); + JavadocReport mojo = lookupMojo( testPom ); + mojo.execute(); + + File apidocs = new File( getBasedir(), "target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs" ); + assertTrue( apidocs.isDirectory() ); + assertTrue( getOverviewSummary( apidocs ).isFile() ); + } + + private static File getOverviewSummary(File apidocs) + { + if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) ) + { + return new File( apidocs, "overview-summary.html" ); + } + return new File( apidocs, "index.html" ); + } + +} diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java index 3dc5ffdde..4200ec055 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java @@ -54,17 +54,18 @@ import org.apache.maven.plugins.javadoc.ProxyServer.AuthAsyncProxyServlet; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuildingRequest; -import org.apache.maven.repository.internal.MavenRepositorySystemSession; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Settings; import org.apache.maven.shared.utils.StringUtils; import org.apache.maven.shared.utils.io.FileUtils; import org.codehaus.plexus.languages.java.version.JavaVersion; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; +import org.eclipse.aether.repository.LocalRepository; import org.hamcrest.MatcherAssert; import org.junit.AssumptionViolatedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager; /** * Test {@link org.apache.maven.plugins.javadoc.JavadocReport} class. @@ -505,8 +506,8 @@ public void testDoclets() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -687,8 +688,8 @@ public void testTaglets() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -982,8 +983,8 @@ public void testProxy() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -1194,8 +1195,8 @@ public void testTagletArtifacts() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -1208,24 +1209,8 @@ public void testTagletArtifacts() assertThat( optionsFile ).exists(); String options = readFile( optionsFile ); // count -taglet - assertThat( StringUtils.countMatches( options, LINE_SEPARATOR + "-taglet" + LINE_SEPARATOR ) ).isEqualTo( 22 ); - assertThat( options ).contains( "org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet" ) + assertThat( StringUtils.countMatches( options, LINE_SEPARATOR + "-taglet" + LINE_SEPARATOR ) ).isEqualTo( 3 ); + assertThat( options ) .contains( "org.codehaus.plexus.javadoc.PlexusConfigurationTaglet" ) .contains( "org.codehaus.plexus.javadoc.PlexusRequirementTaglet" ) .contains( "org.codehaus.plexus.javadoc.PlexusComponentTaglet" ); @@ -1248,8 +1233,8 @@ public void testStylesheetfile() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -1370,8 +1355,8 @@ public void testHelpfile() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); diff --git a/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml b/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml index 0656dc06c..8639b5575 100644 --- a/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml +++ b/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml @@ -65,11 +65,6 @@ under the License. true true - - org.apache.maven.plugin-tools - maven-plugin-tools-javadoc - 3.5 - org.codehaus.plexus plexus-javadoc From 40cc602f84dbb0689020b55b24970cdd7147722c Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sun, 17 Apr 2022 09:43:05 +0200 Subject: [PATCH 14/14] [maven-release-plugin] prepare release maven-javadoc-plugin-3.4.0 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 5f4a94e9d..7cf1294af 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ under the License. maven-javadoc-plugin - 3.3.3-SNAPSHOT + 3.4.0 maven-plugin Apache Maven Javadoc Plugin @@ -48,7 +48,7 @@ under the License. scm:git:https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git https://github.com/apache/maven-javadoc-plugin/tree/${project.scm.tag} - HEAD + maven-javadoc-plugin-3.4.0 jira @@ -77,7 +77,7 @@ under the License. 3.11.0 3.2.2 - 2022-02-07T20:54:37Z + 2022-04-17T07:41:18Z 1.7.32