Skip to content

Commit a10f0b1

Browse files
committed
[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 <[email protected]> This closes #158
1 parent c19dba2 commit a10f0b1

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ under the License.
7575
<plexus-java.version>1.1.0</plexus-java.version>
7676
<jetty.version>9.4.43.v20210629</jetty.version>
7777
<!-- for ITs -->
78-
<sitePluginVersion>3.11.0</sitePluginVersion>
78+
<sitePluginVersion>3.12.1</sitePluginVersion>
7979
<projectInfoReportsPluginVersion>3.2.2</projectInfoReportsPluginVersion>
8080
<project.build.outputTimestamp>2022-04-17T07:43:18Z</project.build.outputTimestamp>
8181
<slf4j.version>1.7.32</slf4j.version>
@@ -207,7 +207,7 @@ under the License.
207207
<dependency>
208208
<groupId>org.apache.maven.reporting</groupId>
209209
<artifactId>maven-reporting-api</artifactId>
210-
<version>3.1.0</version>
210+
<version>3.1.1</version>
211211
</dependency>
212212
<dependency>
213213
<groupId>org.apache.maven</groupId>

src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java

+30-6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.stream.Collectors;
2929

3030
import org.apache.maven.doxia.sink.Sink;
31+
import org.apache.maven.doxia.sink.SinkFactory;
3132
import org.apache.maven.doxia.siterenderer.RenderingContext;
3233
import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
3334
import org.apache.maven.plugin.MojoExecutionException;
@@ -37,7 +38,7 @@
3738
import org.apache.maven.plugins.annotations.Mojo;
3839
import org.apache.maven.plugins.annotations.Parameter;
3940
import org.apache.maven.plugins.annotations.ResolutionScope;
40-
import org.apache.maven.reporting.MavenReport;
41+
import org.apache.maven.reporting.MavenMultiPageReport;
4142
import org.apache.maven.reporting.MavenReportException;
4243
import org.codehaus.plexus.util.StringUtils;
4344

@@ -55,7 +56,7 @@
5556
@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
5657
public class JavadocReport
5758
extends AbstractJavadocMojo
58-
implements MavenReport
59+
implements MavenMultiPageReport
5960
{
6061
// ----------------------------------------------------------------------
6162
// Report Mojo Parameters
@@ -125,8 +126,22 @@ public String getDescription( Locale locale )
125126

126127
/** {@inheritDoc} */
127128
@Override
129+
public void generate( org.codehaus.doxia.sink.Sink sink, Locale locale )
130+
throws MavenReportException
131+
{
132+
generate( sink, null, locale );
133+
}
134+
128135
public void generate( Sink sink, Locale locale )
129136
throws MavenReportException
137+
{
138+
generate( sink, null, locale );
139+
}
140+
141+
/** {@inheritDoc} */
142+
@Override
143+
public void generate( Sink sink, SinkFactory sinkFactory, Locale locale )
144+
throws MavenReportException
130145
{
131146
outputDirectory = getReportOutputDirectory();
132147

@@ -316,12 +331,21 @@ public void doExecute()
316331
return;
317332
}
318333

334+
File outputDirectory = new File( getOutputDirectory() );
335+
336+
String filename = getOutputName() + ".html";
337+
338+
Locale locale = Locale.getDefault();
339+
319340
try
320341
{
321-
RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" );
322-
SiteRendererSink sink = new SiteRendererSink( context );
323-
Locale locale = Locale.getDefault();
324-
generate( sink, locale );
342+
// TODO Replace null with real value
343+
RenderingContext docRenderingContext = new RenderingContext( outputDirectory, filename, null );
344+
345+
SiteRendererSink sink = new SiteRendererSink( docRenderingContext );
346+
347+
generate( sink, null, locale );
348+
325349
}
326350
catch ( MavenReportException | RuntimeException e )
327351
{

0 commit comments

Comments
 (0)