This is an automated email from the ASF dual-hosted git repository. hboutemy pushed a commit to branch multi-page in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git
commit ba96c1e5232937ad9e6af3acee2babd0b78b20c6 Author: Hervé Boutemy <[email protected]> AuthorDate: Tue Dec 23 11:41:07 2025 -0500 add multi-page report test --- .../reporting/its/custom/MultiPageReport.java | 65 ++++++++++++++++++++++ .../use-as-direct-mojo-markup/invoker.properties | 1 + src/it/use-as-direct-mojo-markup/verify.groovy | 5 ++ src/it/use-as-direct-mojo/invoker.properties | 1 + src/it/use-as-direct-mojo/verify.groovy | 6 ++ src/it/use-as-site-report/verify.groovy | 6 ++ 6 files changed, 84 insertions(+) diff --git a/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom/MultiPageReport.java b/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom/MultiPageReport.java new file mode 100644 index 0000000..b8c88bb --- /dev/null +++ b/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom/MultiPageReport.java @@ -0,0 +1,65 @@ +package org.apache.maven.reporting.its.custom; + +/* + * 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.util.Locale; + +import java.io.IOException; +import org.apache.maven.doxia.sink.Sink; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.reporting.MavenReportRenderer; + +/** + * Sample multi-page report. + */ +@Mojo( name = "multi-page" ) +public class MultiPageReport + extends CustomReportWithRenderer +{ + public String getOutputName() + { + return "multi-page"; + } + + public String getName( Locale locale ) + { + return "Multi Page Maven Report"; + } + + public String getDescription( Locale locale ) + { + return "Multi Page Maven Report Description"; + } + + protected void executeReport( Locale locale ) + throws MavenReportException + { + super.executeReport(locale); + + try { + Sink second = getSinkFactory().createSink(outputDirectory, "multi-second.html"); + MavenReportRenderer r = new CustomReportRenderer(second); + r.render(); + } catch (IOException e) { + throw new MavenReportException("Could not create sink", e); + } + } +} diff --git a/src/it/use-as-direct-mojo-markup/invoker.properties b/src/it/use-as-direct-mojo-markup/invoker.properties index a0197fd..484a522 100644 --- a/src/it/use-as-direct-mojo-markup/invoker.properties +++ b/src/it/use-as-direct-mojo-markup/invoker.properties @@ -18,3 +18,4 @@ invoker.goals.1 = custom-reporting:custom -Doutput.format=xdoc invoker.goals.2 = custom-reporting:custom-renderer -Doutput.format=apt invoker.goals.3 = custom-reporting:external -Doutput.format=anything +invoker.goals.4 = custom-reporting:multi-page -Doutput.format=xhtml diff --git a/src/it/use-as-direct-mojo-markup/verify.groovy b/src/it/use-as-direct-mojo-markup/verify.groovy index c4a6bc3..4050c90 100644 --- a/src/it/use-as-direct-mojo-markup/verify.groovy +++ b/src/it/use-as-direct-mojo-markup/verify.groovy @@ -31,4 +31,9 @@ f = new File( outputDir, 'external/report.html' ); assert f.exists(); assert f.text.contains( '<h1>External Report</h1>' ); +f = new File( outputDir, 'multi-page.xhtml' ); +assert f.exists(); +f = new File( outputDir, 'multi-second.html' ); +assert f.exists(); + return true; diff --git a/src/it/use-as-direct-mojo/invoker.properties b/src/it/use-as-direct-mojo/invoker.properties index e6cbf2d..f26b482 100644 --- a/src/it/use-as-direct-mojo/invoker.properties +++ b/src/it/use-as-direct-mojo/invoker.properties @@ -18,3 +18,4 @@ invoker.goals.1 = custom-reporting:custom invoker.goals.2 = custom-reporting:custom-renderer invoker.goals.3 = custom-reporting:external +#invoker.goals.4 = custom-reporting:multi-page # https://github.com/apache/maven-reporting-impl/issues/217 diff --git a/src/it/use-as-direct-mojo/verify.groovy b/src/it/use-as-direct-mojo/verify.groovy index e135efb..3db9394 100644 --- a/src/it/use-as-direct-mojo/verify.groovy +++ b/src/it/use-as-direct-mojo/verify.groovy @@ -34,4 +34,10 @@ f = new File( outputDir, 'external/report.html' ); assert f.exists(); assert f.text.contains( '<h1>External Report</h1>' ); +// https://github.com/apache/maven-reporting-impl/issues/217 +/*f = new File( outputDir, 'multi-page.html' ); +assert f.exists(); +f = new File( outputDir, 'multi-second.html' ); +assert f.exists();*/ + return true; diff --git a/src/it/use-as-site-report/verify.groovy b/src/it/use-as-site-report/verify.groovy index 3a5ad32..b531236 100644 --- a/src/it/use-as-site-report/verify.groovy +++ b/src/it/use-as-site-report/verify.groovy @@ -34,4 +34,10 @@ f = new File( site, 'external/report.html' ); assert f.exists(); assert f.text.contains( '<h1>External Report</h1>' ); +f = new File( site, 'multi-page.html' ); +assert f.exists(); +f = new File( site, 'multi-second.html' ); +assert f.exists(); + + return true;
