You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/08/10 19:47:25 UTC
[maven-javadoc-plugin] branch master updated: [MJAVADOC-723] Upgrade Maven Reporting API to 3.1.1/Complete with Maven Reporting Impl 3.2.0
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new a10f0b11 [MJAVADOC-723] Upgrade Maven Reporting API to 3.1.1/Complete with Maven Reporting Impl 3.2.0
a10f0b11 is described below
commit a10f0b11e89fd65d61938186ddf16fb86ded239e
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Mon Aug 8 21:52:41 2022 +0200
[MJAVADOC-723] Upgrade Maven Reporting API to 3.1.1/Complete with Maven Reporting Impl 3.2.0
This not only upgrades to Maven Reporting API 3.1.1, but also logically
completes this plugin with bits from Maven Reporting Impl 3.2.0 because
we cannot inherit from AbstractMavenReport since Java does not support
multiple inheritance. It should now behave as if using m-r-impl.
Co-authored-by: Piotrek Żygieło <pz...@users.noreply.github.com>
This closes #158
---
pom.xml | 4 +--
.../maven/plugins/javadoc/JavadocReport.java | 36 ++++++++++++++++++----
2 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index cc763f61..8fb6bbc3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,7 +75,7 @@ under the License.
<plexus-java.version>1.1.0</plexus-java.version>
<jetty.version>9.4.43.v20210629</jetty.version>
<!-- for ITs -->
- <sitePluginVersion>3.11.0</sitePluginVersion>
+ <sitePluginVersion>3.12.1</sitePluginVersion>
<projectInfoReportsPluginVersion>3.2.2</projectInfoReportsPluginVersion>
<project.build.outputTimestamp>2022-04-17T07:43:18Z</project.build.outputTimestamp>
<slf4j.version>1.7.32</slf4j.version>
@@ -207,7 +207,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
- <version>3.1.0</version>
+ <version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
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 7be50290..4ba2f67c 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
@@ -28,6 +28,7 @@ import java.util.ResourceBundle;
import java.util.stream.Collectors;
import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.SinkFactory;
import org.apache.maven.doxia.siterenderer.RenderingContext;
import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
import org.apache.maven.plugin.MojoExecutionException;
@@ -37,7 +38,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.reporting.MavenReport;
+import org.apache.maven.reporting.MavenMultiPageReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.util.StringUtils;
@@ -55,7 +56,7 @@ import org.codehaus.plexus.util.StringUtils;
@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
public class JavadocReport
extends AbstractJavadocMojo
- implements MavenReport
+ implements MavenMultiPageReport
{
// ----------------------------------------------------------------------
// Report Mojo Parameters
@@ -125,8 +126,22 @@ public class JavadocReport
/** {@inheritDoc} */
@Override
+ public void generate( org.codehaus.doxia.sink.Sink sink, Locale locale )
+ throws MavenReportException
+ {
+ generate( sink, null, locale );
+ }
+
public void generate( Sink sink, Locale locale )
throws MavenReportException
+ {
+ generate( sink, null, locale );
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void generate( Sink sink, SinkFactory sinkFactory, Locale locale )
+ throws MavenReportException
{
outputDirectory = getReportOutputDirectory();
@@ -316,12 +331,21 @@ public class JavadocReport
return;
}
+ File outputDirectory = new File( getOutputDirectory() );
+
+ String filename = getOutputName() + ".html";
+
+ Locale locale = Locale.getDefault();
+
try
{
- RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" );
- SiteRendererSink sink = new SiteRendererSink( context );
- Locale locale = Locale.getDefault();
- generate( sink, locale );
+ // TODO Replace null with real value
+ RenderingContext docRenderingContext = new RenderingContext( outputDirectory, filename, null );
+
+ SiteRendererSink sink = new SiteRendererSink( docRenderingContext );
+
+ generate( sink, null, locale );
+
}
catch ( MavenReportException | RuntimeException e )
{