Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[MJAVADOC-723] Upgrade Maven Reporting API to 3.1.1/Complete with Maven Reporting Impl 3.2.0 #158

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
36 changes: 30 additions & 6 deletions src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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;
Expand All @@ -37,7 +38,7 @@
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;

Expand All @@ -55,7 +56,7 @@
@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
public class JavadocReport
extends AbstractJavadocMojo
implements MavenReport
implements MavenMultiPageReport
{
// ----------------------------------------------------------------------
// Report Mojo Parameters
Expand Down Expand Up @@ -125,8 +126,22 @@ public String getDescription( Locale locale )

/** {@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();

Expand Down Expand Up @@ -316,12 +331,21 @@ public void doExecute()
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 )
{
Expand Down