From 117f61aa2811c947e2bbcd6b0c6c3b5c1f18896a Mon Sep 17 00:00:00 2001 From: Matt Nelson Date: Mon, 29 Jul 2024 11:34:33 -0500 Subject: [PATCH] [MPLUGIN-529] Add new report goal 'report-no-fork' which will not invoke process-classes Co-authored-by: Michael Osipov This closes #310 --- .../src/it/fix-maven-since-3.x/pom.xml | 7 + .../src/it/mplugin-191/pom.xml | 178 ++++++++-------- .../src/it/mplugin-319_report-since/pom.xml | 189 +++++++++-------- .../it/mplugin-394_report-encoding/pom.xml | 7 + .../plugin-info-jdk-default-version/pom.xml | 7 + .../src/it/plugin-info-jdk/pom.xml | 7 + .../plugin-no-fork-report/invoker.properties | 18 ++ .../src/it/plugin-no-fork-report/pom.xml | 159 ++++++++++++++ .../src/main/java/org/DummyReport.java | 200 ++++++++++++++++++ .../src/main/java/org/MyMojo.java | 65 ++++++ .../it/plugin-no-fork-report/verify.groovy | 44 ++++ .../src/it/plugin-report-annotations/pom.xml | 7 + .../pom.xml | 7 + .../pom.xml | 7 + .../plugin-report-with-javadoc-links/pom.xml | 7 + .../src/it/plugin-report/pom.xml | 7 + .../plugin/report/PluginNoForkReport.java | 34 +++ .../site/apt/examples/generate-report.apt.vm | 43 ++++ .../src/site/apt/index.apt | 9 +- pom.xml | 1 + 20 files changed, 823 insertions(+), 180 deletions(-) create mode 100644 maven-plugin-report-plugin/src/it/plugin-no-fork-report/invoker.properties create mode 100644 maven-plugin-report-plugin/src/it/plugin-no-fork-report/pom.xml create mode 100644 maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/DummyReport.java create mode 100644 maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/MyMojo.java create mode 100644 maven-plugin-report-plugin/src/it/plugin-no-fork-report/verify.groovy create mode 100644 maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java diff --git a/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml b/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml index b36696602..26ace221e 100644 --- a/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml +++ b/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml @@ -93,6 +93,13 @@ org.apache.maven.plugins maven-plugin-report-plugin @project.version@ + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/mplugin-191/pom.xml b/maven-plugin-report-plugin/src/it/mplugin-191/pom.xml index f060f2d63..5a314eb8b 100644 --- a/maven-plugin-report-plugin/src/it/mplugin-191/pom.xml +++ b/maven-plugin-report-plugin/src/it/mplugin-191/pom.xml @@ -1,86 +1,92 @@ - - - - - - 4.0.0 - - org.apache.maven.plugins.plugin.its - mplugin-191 - 1.0-SNAPSHOT - maven-plugin - - Verify that plugin-info.html and mojo pages are generated in the correct folder - - - UTF-8 - - - - - org.apache.maven.plugin-tools - maven-plugin-annotations - @project.version@ - provided - - - org.apache.maven - maven-plugin-api - @maven3Version@ - provided - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @compilerPluginVersion@ - - - org.apache.maven.plugins - maven-plugin-plugin - @project.version@ - - true - prefix - - - - org.apache.maven.plugins - maven-site-plugin - @sitePluginVersion@ - - - - - - true - - - org.apache.maven.plugins - maven-plugin-report-plugin - @project.version@ - - - - - + + + + + + 4.0.0 + + org.apache.maven.plugins.plugin.its + mplugin-191 + 1.0-SNAPSHOT + maven-plugin + + Verify that plugin-info.html and mojo pages are generated in the correct folder + + + UTF-8 + + + + + org.apache.maven.plugin-tools + maven-plugin-annotations + @project.version@ + provided + + + org.apache.maven + maven-plugin-api + @maven3Version@ + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + @compilerPluginVersion@ + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + true + prefix + + + + org.apache.maven.plugins + maven-site-plugin + @sitePluginVersion@ + + + + + + true + + + org.apache.maven.plugins + maven-plugin-report-plugin + @project.version@ + + + + report + + + + + + + diff --git a/maven-plugin-report-plugin/src/it/mplugin-319_report-since/pom.xml b/maven-plugin-report-plugin/src/it/mplugin-319_report-since/pom.xml index 922537674..c20b087e0 100644 --- a/maven-plugin-report-plugin/src/it/mplugin-319_report-since/pom.xml +++ b/maven-plugin-report-plugin/src/it/mplugin-319_report-since/pom.xml @@ -1,91 +1,98 @@ - - - - - - 4.0.0 - - org.apache.maven.plugins.its.plugin - report-since - 1.0-SNAPSHOT - maven-plugin - - - UTF-8 - - - - - org.apache.maven - maven-plugin-api - @maven3Version@ - provided - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @compilerPluginVersion@ - - - org.apache.maven.plugins - maven-plugin-plugin - @project.version@ - - prefix - - - - org.apache.maven.plugins - maven-site-plugin - @sitePluginVersion@ - - - - - - - true - - - org.apache.maven.plugins - maven-project-info-reports-plugin - @projectInfoReportsPlugin@ - - - - index - - - - - - org.apache.maven.plugins - maven-plugin-report-plugin - @project.version@ - - - - + + + + + + 4.0.0 + + org.apache.maven.plugins.its.plugin + report-since + 1.0-SNAPSHOT + maven-plugin + + + UTF-8 + + + + + org.apache.maven + maven-plugin-api + @maven3Version@ + provided + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + @compilerPluginVersion@ + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + prefix + + + + org.apache.maven.plugins + maven-site-plugin + @sitePluginVersion@ + + + + + + + true + + + org.apache.maven.plugins + maven-project-info-reports-plugin + @projectInfoReportsPlugin@ + + + + index + + + + + + org.apache.maven.plugins + maven-plugin-report-plugin + @project.version@ + + + + report + + + + + + + diff --git a/maven-plugin-report-plugin/src/it/mplugin-394_report-encoding/pom.xml b/maven-plugin-report-plugin/src/it/mplugin-394_report-encoding/pom.xml index 71b280838..87c0ec10d 100644 --- a/maven-plugin-report-plugin/src/it/mplugin-394_report-encoding/pom.xml +++ b/maven-plugin-report-plugin/src/it/mplugin-394_report-encoding/pom.xml @@ -84,6 +84,13 @@ under the License. org.apache.maven.plugins maven-plugin-report-plugin @project.version@ + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-info-jdk-default-version/pom.xml b/maven-plugin-report-plugin/src/it/plugin-info-jdk-default-version/pom.xml index 7ef059ac5..9e94ec442 100644 --- a/maven-plugin-report-plugin/src/it/plugin-info-jdk-default-version/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-info-jdk-default-version/pom.xml @@ -88,6 +88,13 @@ under the License. org.apache.maven.plugins maven-plugin-report-plugin @project.version@ + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-info-jdk/pom.xml b/maven-plugin-report-plugin/src/it/plugin-info-jdk/pom.xml index 4772fd3da..777144aa0 100644 --- a/maven-plugin-report-plugin/src/it/plugin-info-jdk/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-info-jdk/pom.xml @@ -95,6 +95,13 @@ under the License. ${project.build.outputDirectory}/META-INF/maven/plugin-enhanced.xml + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-no-fork-report/invoker.properties b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/invoker.properties new file mode 100644 index 000000000..7cd15185b --- /dev/null +++ b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/invoker.properties @@ -0,0 +1,18 @@ +# 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. + +invoker.goals = clean verify site diff --git a/maven-plugin-report-plugin/src/it/plugin-no-fork-report/pom.xml b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/pom.xml new file mode 100644 index 000000000..66a3e2515 --- /dev/null +++ b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/pom.xml @@ -0,0 +1,159 @@ + + + + + + 4.0.0 + + org.apache.maven.its + plugin-no-fork-report + 1.0-SNAPSHOT + maven-plugin + + MPLUGIN-529 + + Test basic site generation to guard against regression. + + + + UTF-8 + + + + + org.apache.maven + maven-plugin-api + @maven3Version@ + provided + + + org.apache.maven + maven-artifact + @maven3Version@ + provided + + + org.apache.maven + maven-core + @maven3Version@ + provided + + + org.apache.maven.plugin-tools + maven-plugin-annotations + @project.version@ + provided + + + org.apache.maven.reporting + maven-reporting-api + @reportingApiVersion@ + + + org.apache.maven.reporting + maven-reporting-impl + @reportingImplVersion@ + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + @compilerPluginVersion@ + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + @enforcerPluginVersion@ + + + + enforce + + validate + + + + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + true + prefix + + + + mojo-descriptor + + descriptor + + + + + + org.apache.maven.plugins + maven-site-plugin + @sitePluginVersion@ + + + + + + true + + + org.apache.maven.plugins + maven-project-info-reports-plugin + @projectInfoReportsPlugin@ + + + + index + + + + + + org.apache.maven.plugins + maven-plugin-report-plugin + @project.version@ + + + + report-no-fork + + + + + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/DummyReport.java b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/DummyReport.java new file mode 100644 index 000000000..66315bcdf --- /dev/null +++ b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/DummyReport.java @@ -0,0 +1,200 @@ +/* + * 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. + */ +package org; + +import java.io.File; +import java.util.Locale; +import java.util.ResourceBundle; + +import org.apache.maven.doxia.sink.Sink; +import org.apache.maven.doxia.siterenderer.Renderer; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Execute; +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.project.MavenProject; +import org.apache.maven.reporting.AbstractMavenReport; +import org.apache.maven.reporting.AbstractMavenReportRenderer; +import org.apache.maven.reporting.MavenReportException; + +/** + * Dummy Reporting Plugin. + */ +@Mojo(name = "report", requiresReports = true) +@Execute(phase = LifecyclePhase.COMPILE) +public class DummyReport extends AbstractMavenReport { + /** + * Report output directory. + */ + @Parameter(defaultValue = "${project.build.directory}/generated-site/xdoc") + private File outputDirectory; + + /** + * Doxia Site Renderer. + */ + @Component + private Renderer siteRenderer; + + /** + * The Maven Project. + */ + @Parameter(property = "project", readonly = true, required = true) + private MavenProject project; + + /** + * The goal prefix that will appear before the ":". + * + * @since 2.4 + */ + @Parameter(property = "goalPrefix") + protected String goalPrefix; + + /** + * Set this to "true" to skip invoking any goals or reports of the plugin. + * + * @since 2.8 + */ + @Parameter(defaultValue = "false", property = "maven.plugin.skip") + private boolean skip; + + /** + * Set this to "true" to skip generating the report. + * + * @since 2.8 + */ + @Parameter(defaultValue = "false", property = "maven.plugin.report.skip") + private boolean skipReport; + + /** + * {@inheritDoc} + */ + protected Renderer getSiteRenderer() { + return siteRenderer; + } + + /** + * {@inheritDoc} + */ + protected String getOutputDirectory() { + return outputDirectory.getPath(); + } + + /** + * {@inheritDoc} + */ + protected MavenProject getProject() { + return project; + } + + /** + * {@inheritDoc} + */ + public boolean canGenerateReport() { + if (skip || skipReport) { + getLog().info("Maven Plugin Plugin Report generation skipped."); + return false; + } + + return true; + } + + /** + * {@inheritDoc} + */ + protected void executeReport(Locale locale) throws MavenReportException { + // Generate the plugin's documentation + generatePluginDocumentation(locale); + } + + /** + * {@inheritDoc} + */ + public String getDescription(Locale locale) { + return getBundle(locale).getString("report.plugin.description"); + } + + /** + * {@inheritDoc} + */ + public String getName(Locale locale) { + return getBundle(locale).getString("report.plugin.name"); + } + + /** + * {@inheritDoc} + */ + public String getOutputName() { + return "plugin-info"; + } + + /** + * @param pluginDescriptor not null + * @param locale not null + * @throws MavenReportException if any + */ + private void generatePluginDocumentation(Locale locale) throws MavenReportException { + File outputDir = new File(getOutputDirectory()); + outputDir.mkdirs(); + PluginOverviewRenderer r = new PluginOverviewRenderer(getSink(), locale); + r.render(); + } + + /** + * @param locale not null + * @return the bundle for this report + */ + protected static ResourceBundle getBundle(Locale locale) { + return ResourceBundle.getBundle("plugin-report", locale, DummyReport.class.getClassLoader()); + } + + /** + * Generates an overview page with the list of goals + * and a link to the goal's page. + */ + static class PluginOverviewRenderer extends AbstractMavenReportRenderer { + private final Locale locale; + + /** + * @param sink not null + * @param locale not null + */ + PluginOverviewRenderer(Sink sink, Locale locale) { + super(sink); + + this.locale = locale; + } + + /** + * {@inheritDoc} + */ + public String getTitle() { + return getBundle(locale).getString("report.plugin.title"); + } + + /** + * {@inheritDoc} + */ + protected void renderBody() { + startSection(getTitle()); + paragraph("This is a report."); + endSection(); + } + } +} diff --git a/maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/MyMojo.java b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/MyMojo.java new file mode 100644 index 000000000..d2f2e77f9 --- /dev/null +++ b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/src/main/java/org/MyMojo.java @@ -0,0 +1,65 @@ +/* + * 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. + */ +package org; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugins.annotations.Execute; +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; + +/** + * Does nothing. + * + * @since 1.0 + * @deprecated You don't use test goals, do you? + */ +@Mojo( + name = "noop", + defaultPhase = LifecyclePhase.PROCESS_SOURCES, + requiresDependencyResolution = ResolutionScope.TEST, + requiresDirectInvocation = true, + requiresOnline = true, + inheritByDefault = false, + aggregator = true) +@Execute(phase = LifecyclePhase.COMPILE) +public class MyMojo extends AbstractMojo { + + /** + * This is a test. + */ + @SuppressWarnings("unused") + @Parameter(required = true) + private String required; + + /** + * This is a test. + * + * @since 1.1 + * @deprecated Just testing. + */ + @SuppressWarnings("unused") + @Parameter(property = "string", defaultValue = "${project.version}/") + private String string; + + public void execute() { + // intentional do nothing + } +} diff --git a/maven-plugin-report-plugin/src/it/plugin-no-fork-report/verify.groovy b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/verify.groovy new file mode 100644 index 000000000..eb6aa8d17 --- /dev/null +++ b/maven-plugin-report-plugin/src/it/plugin-no-fork-report/verify.groovy @@ -0,0 +1,44 @@ +/* + * 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. + */ + +assert new File( basedir, 'target/site/noop-mojo.html' ).isFile() +assert new File( basedir, 'target/site/report-mojo.html' ).isFile() + +def pluginInfo = new File( basedir, 'target/site/plugin-info.html' ) +assert pluginInfo.isFile() + +assert !pluginInfo.text.contains('Memory') +assert !pluginInfo.text.contains('Disk Space') +// check JDK and Maven requirements +assert pluginInfo.text.contains('1.8') +assert pluginInfo.text.contains('3.9.8') + +// deprecated info and description +assert pluginInfo.text.contains('
Deprecated. You don\'t use test goals, do you?

') +assert pluginInfo.text.contains('Does nothing.') + + +def noopMojo = new File( basedir, 'target/site/noop-mojo.html' ) +assert noopMojo.isFile() + +// deprecated in table and details +assert noopMojo.text.count('
Deprecated.
Just testing.

') == 2 + +assert 1 == new File( basedir, 'build.log' ).text.count('Always pass!'); + diff --git a/maven-plugin-report-plugin/src/it/plugin-report-annotations/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report-annotations/pom.xml index 864caed1f..ade4fdf35 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report-annotations/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-report-annotations/pom.xml @@ -128,6 +128,13 @@ under the License. org.apache.maven.plugins maven-plugin-report-plugin @project.version@ + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml index e38c90b6e..ab9ea0849 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml @@ -87,6 +87,13 @@ under the License. [3,3.7.0] + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-report-requirements-history/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report-requirements-history/pom.xml index b0082ccb9..2957fa527 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report-requirements-history/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-report-requirements-history/pom.xml @@ -98,6 +98,13 @@ under the License. + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-report-with-javadoc-links/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report-with-javadoc-links/pom.xml index 439d392fb..98beacbf0 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report-with-javadoc-links/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-report-with-javadoc-links/pom.xml @@ -141,6 +141,13 @@ under the License. org.apache.maven.plugins maven-plugin-report-plugin @project.version@ + + + + report + + + diff --git a/maven-plugin-report-plugin/src/it/plugin-report/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report/pom.xml index ae23b4892..1f5c9c81f 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-report/pom.xml @@ -118,6 +118,13 @@ under the License. org.apache.maven.plugins maven-plugin-report-plugin @project.version@ + + + + report + + + diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java new file mode 100644 index 000000000..0da07833f --- /dev/null +++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java @@ -0,0 +1,34 @@ +/* + * 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. + */ +package org.apache.maven.plugin.plugin.report; + +import org.apache.maven.plugins.annotations.Execute; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +/** + * Generates the Plugin's documentation report: plugin-info.html plugin overview page, + * and one goal-mojo.html per goal. + * Relies on one output file from plugin:descriptor. + * + * @since 3.14.0 + */ +@Mojo(name = "report-no-fork", threadSafe = true) +@Execute(phase = LifecyclePhase.NONE) +public class PluginNoForkReport extends PluginReport {} diff --git a/maven-plugin-report-plugin/src/site/apt/examples/generate-report.apt.vm b/maven-plugin-report-plugin/src/site/apt/examples/generate-report.apt.vm index 1f89f59dc..c66afdbdd 100644 --- a/maven-plugin-report-plugin/src/site/apt/examples/generate-report.apt.vm +++ b/maven-plugin-report-plugin/src/site/apt/examples/generate-report.apt.vm @@ -39,12 +39,55 @@ Configuring Generation of Documentation Reports org.apache.maven.plugins maven-plugin-report-plugin ${project.version} + + + + report + + + + ... ... ++-----+ + +* Generate Plugin Report without duplicate execution of phase process-classes + + The standard report goal <<>> invokes separate lifecyle of <<>>. + In a CI environment you now might execute something like <<>>. + During <<>> build the standard reports will trigger <<>> again, depending on your build this may take some time, because + stuff like <<>> or generating stubs from a WDSL will be invoked again, which may lead + to longer build times. + + As of version 3.14.0 a new report goal is defined, <<>> which will not trigger above phase a second time. + + Configure this in your <<>> section as follows: + ++-----+ + + ... + + + + org.apache.maven.plugins + maven-plugin-report-plugin + ${project.version} + + + + report-no-fork + + + + + + + ... + +-----+ The documentation is generated by default in <<<$\{project.build.directory\}/site>>>. diff --git a/maven-plugin-report-plugin/src/site/apt/index.apt b/maven-plugin-report-plugin/src/site/apt/index.apt index 92baffe91..24117bbc9 100644 --- a/maven-plugin-report-plugin/src/site/apt/index.apt +++ b/maven-plugin-report-plugin/src/site/apt/index.apt @@ -32,10 +32,13 @@ Maven Plugin Report Plugin * Goals Overview - The Plugin Report Plugin has one goal {{{./report-mojo.html}plugin-report:report}} which generates the plugin - documentation: one overview report and documentation for each plugin's goal (mojo). + The Plugin Report Plugin has two goals: - [] + * {{{./report-mojo.html}plugin-report:report}} which generates the plugin documentation: one overview report and documentation for each plugin's goal (mojo). + + * {{{./report-no-fork-mojo.html}plugin-report:report-no-fork}} which generates the plugin documentation: one overview report and documentation for each plugin's goal (mojo) without forking the <<>> phase again. Note that this goal does require generation of classes before site generation, e.g. by invoking <<>>. + + [] * Usage diff --git a/pom.xml b/pom.xml index d126be0e9..0b8f141f9 100644 --- a/pom.xml +++ b/pom.xml @@ -108,6 +108,7 @@ 3.2.0 3.11.0 3.5.0 + 3.5.0 2024-05-28T08:15:05Z