You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/12 19:18:43 UTC

[GitHub] [maven-plugin-tools] michael-o commented on a diff in pull request #147: [MPLUGIN-423] Extract plugin report into its own plugin and deprecate the previous one

michael-o commented on code in PR #147:
URL: https://github.com/apache/maven-plugin-tools/pull/147#discussion_r993794117


##########
maven-plugin-report-plugin/src/it/mplugin-394_report-encoding/invoker.properties:
##########
@@ -15,4 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.goals = clean plugin:report
+invoker.goals = -Dfile.encoding=CP1252 site

Review Comment:
   @slawekjaranowski This is the stuff I have told you about...



##########
maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java:
##########
@@ -226,6 +228,10 @@ public boolean canGenerateReport()
     protected void executeReport( Locale locale )
         throws MavenReportException
     {
+        getLog().warn( "The report of the maven-plugin-plugin is deprecated, please use "
+                + "the report from the maven-plugin-report-plugin instead. This plugin will be removed "
+                + "in version 4.0.0." );
+

Review Comment:
   Important: The plugin is *not* removed, but just the report goal. Therfore: "report goal", "plugin goal"



##########
maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java:
##########
@@ -0,0 +1,792 @@
+package org.apache.maven.plugin.plugin.report;
+
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
+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.plugins.plugin.descriptor.MNG6109PluginDescriptorBuilder;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.AbstractMavenReport;
+import org.apache.maven.reporting.AbstractMavenReportRenderer;
+import org.apache.maven.reporting.MavenReportException;
+import org.apache.maven.rtinfo.RuntimeInformation;
+import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
+import org.apache.maven.tools.plugin.PluginToolsRequest;
+import org.apache.maven.tools.plugin.generator.GeneratorException;
+import org.apache.maven.tools.plugin.generator.GeneratorUtils;
+import org.apache.maven.tools.plugin.generator.PluginXdocGenerator;
+import org.apache.maven.tools.plugin.util.PluginUtils;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Generates the Plugin's documentation report: <code>plugin-info.html</code> plugin overview page,
+ * and one <code><i>goal</i>-mojo.html</code> per goal.
+ *
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @since 2.0
+ */
+@Mojo( name = "report", threadSafe = true )
+@Execute( phase = LifecyclePhase.PROCESS_CLASSES )
+public class PluginReport
+    extends AbstractMavenReport
+{
+    /**
+     * Report output directory for mojos' documentation.
+     */
+    @Parameter( defaultValue = "${project.build.directory}/generated-site/xdoc" )
+    private File outputDirectory;
+
+    /**
+     * The file encoding of the source files.
+     *
+     * @deprecated not used in report, will be removed in the next major version
+     *
+     * @since 2.7
+     */
+    @Deprecated
+    @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
+    private String encoding;
+
+    /**
+     * Specify some requirements to execute this plugin.
+     * Example:
+     * <pre>
+     * &lt;requirements&gt;
+     *   &lt;maven&gt;2.0&lt;/maven&gt;
+     *   &lt;jdk&gt;1.4&lt;/jdk&gt;
+     *   &lt;memory&gt;256m&lt;/memory&gt;
+     *   &lt;diskSpace&gt;1m&lt;/diskSpace&gt;
+     *   &lt;others&gt;
+     *     &lt;property&gt;
+     *       &lt;name&gt;SVN&lt;/name&gt;
+     *       &lt;value&gt;1.4.6&lt;/value&gt;
+     *     &lt;/property&gt;
+     *   &lt;/others&gt;
+     * &lt;/requirements&gt;
+     * </pre>
+     * <p>
+     * If not is specified, Maven requirement is extracted from
+     * <code>&lt;project&gt;&lt;prerequisites&gt;&lt;maven&gt;</code>
+     * and JDK requirement is extracted from maven-compiler-plugin configuration.
+     *
+     * @deprecated will be removed in the next major version, please don't use
+     */
+    @Deprecated
+    @Parameter
+    private Requirements requirements;
+
+    /**
+     * <p>
+     * The goal prefix that will appear before the ":".
+     * By default, this plugin applies a heuristic to derive a heuristic from
+     * the plugin's artifactId.
+     * </p>
+     * <p>
+     * It removes any occurrences of the regular expression <strong>-?maven-?</strong>,
+     * and then removes any occurrences of <strong>-?plugin-?</strong>.
+     * </p>
+     * <p>
+     * For example, horsefeature-maven-plugin becomes horsefeature.
+     * </p>
+     * <p>
+     * (There is a special case for maven-plugin-plugin: it is mapped to 'plugin')
+     * </p>
+     *
+     * @deprecated not used in report, will be removed in the next major version
+     *
+     * @since 2.4
+     */
+    @Deprecated
+    @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;

Review Comment:
   Shouldn't both params be merged into `skip` with `maven.plugin.report.skip` in the future? WDYT?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org