maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [maven-plugin-tools] branch master updated: [MPLUGIN-332] remove plugin:updateRegistry goal, which is unused in Maven 3
Date Mon, 08 Oct 2018 11:26:02 GMT
This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git


The following commit(s) were added to refs/heads/master by this push:
     new 21e630f  [MPLUGIN-332] remove plugin:updateRegistry goal, which is unused in Maven
3
21e630f is described below

commit 21e630f662c51a7e8e430401bb7f0a4bcb7d8066
Author: olivier lamy <olamy@apache.org>
AuthorDate: Mon Oct 8 21:25:44 2018 +1000

    [MPLUGIN-332] remove plugin:updateRegistry goal, which is unused in Maven 3
    
    Signed-off-by: olivier lamy <olamy@apache.org>
---
 maven-plugin-plugin/pom.xml                        |   4 +-
 .../plugin/plugin/UpdatePluginRegistryMojo.java    | 237 ---------------------
 maven-plugin-plugin/src/site/apt/index.apt         |   6 +-
 maven-plugin-plugin/src/site/fml/faq.fml           |  42 ----
 maven-plugin-plugin/src/site/site.xml              |   1 -
 5 files changed, 3 insertions(+), 287 deletions(-)

diff --git a/maven-plugin-plugin/pom.xml b/maven-plugin-plugin/pom.xml
index f69774d..0aee3ad 100644
--- a/maven-plugin-plugin/pom.xml
+++ b/maven-plugin-plugin/pom.xml
@@ -33,8 +33,8 @@
   <name>Maven Plugin Plugin</name>
   <description>
     The Plugin Plugin is used to create a Maven plugin descriptor for any Mojo's found in
the source tree,
-    to include in the JAR. It is also used to generate Xdoc files for the Mojos as well as
for updating the
-    plugin registry, the artifact metadata and a generic help goal.
+    to include in the JAR. It is also used to generate Xdoc files for the Mojos as well as
the artifact metadata
+    and a generic help goal.
   </description>
 
   <properties>
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java
b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java
deleted file mode 100644
index b2caadf..0000000
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package org.apache.maven.plugin.plugin;
-
-/*
- * 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 org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.registry.MavenPluginRegistryBuilder;
-import org.apache.maven.plugin.registry.Plugin;
-import org.apache.maven.plugin.registry.PluginRegistry;
-import org.apache.maven.plugin.registry.PluginRegistryUtils;
-import org.apache.maven.plugin.registry.TrackableBase;
-import org.apache.maven.plugin.registry.io.xpp3.PluginRegistryXpp3Writer;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.WriterFactory;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Update the user plugin registry (if it's in use) to reflect the version we're installing.
- *
- * @since 2.0
- * @deprecated plugin registry has been removed from Maven 3, this goal will be removed in
next release
- */
-@Mojo( name = "updateRegistry", defaultPhase = LifecyclePhase.INSTALL, threadSafe = true
)
-public class UpdatePluginRegistryMojo
-    extends AbstractMojo
-{
-    /**
-     * Indicates whether the <code>plugin-registry.xml</code> file is used by
Maven or not
-     * to manage plugin versions.
-     */
-    @Parameter( defaultValue = "${settings.usePluginRegistry}", required = true, readonly
= true )
-    private boolean usePluginRegistry;
-
-    /**
-     * The group id of the project currently being built.
-     */
-    @Parameter( defaultValue = "${project.groupId}", required = true, readonly = true )
-    private String groupId;
-
-    /**
-     * The artifact id of the project currently being built.
-     */
-    @Parameter( defaultValue = "${project.artifactId}", required = true, readonly = true
)
-    private String artifactId;
-
-    /**
-     * The version of the project currently being built.
-     */
-    @Parameter( defaultValue = "${project.artifact.version}", required = true, readonly =
true )
-    private String version;
-
-    /**
-     * Plexus component for retrieving the plugin registry info.
-     */
-    @Component
-    private MavenPluginRegistryBuilder pluginRegistryBuilder;
-
-    /**
-     * 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 updating the plugin registry.
-     *
-     * @since 2.8
-     */
-    @Parameter( defaultValue = "false", property = "maven.plugin.update.registry.skip" )
-    private boolean skipUpdatePluginRegistry;
-
-    /** {@inheritDoc} */
-    public void execute()
-        throws MojoExecutionException, MojoFailureException
-    {
-        if ( usePluginRegistry )
-        {
-            if ( skip || skipUpdatePluginRegistry )
-            {
-                getLog().warn( "Execution skipped" );
-                return;
-            }
-            updatePluginVersionInRegistry( groupId, artifactId, version );
-        }
-    }
-
-    /**
-     * @param aGroupId not null
-     * @param anArtifactId not null
-     * @param aVersion not null
-     * @throws MojoExecutionException if any
-     */
-    private void updatePluginVersionInRegistry( String aGroupId, String anArtifactId, String
aVersion )
-        throws MojoExecutionException
-    {
-        PluginRegistry pluginRegistry;
-        try
-        {
-            pluginRegistry = getPluginRegistry( aGroupId, anArtifactId );
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException( "Failed to read plugin registry.", e );
-        }
-        catch ( XmlPullParserException e )
-        {
-            throw new MojoExecutionException( "Failed to parse plugin registry.", e );
-        }
-
-        String pluginKey = ArtifactUtils.versionlessKey( aGroupId, anArtifactId );
-        Plugin plugin = (Plugin) pluginRegistry.getPluginsByKey().get( pluginKey );
-
-        // if we can find the plugin, but we've gotten here, the useVersion must be missing;
fill it in.
-        if ( plugin != null )
-        {
-            if ( TrackableBase.GLOBAL_LEVEL.equals( plugin.getSourceLevel() ) )
-            {
-                // do nothing. We don't rewrite the globals, under any circumstances.
-                getLog().warn( "Cannot update registered version for plugin {" + aGroupId
+ ":" + anArtifactId
-                    + "}; it is specified in the global registry." );
-            }
-            else
-            {
-                plugin.setUseVersion( aVersion );
-
-                SimpleDateFormat format =
-                    new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT
);
-
-                plugin.setLastChecked( format.format( new Date() ) );
-            }
-        }
-        else
-        {
-            plugin = new org.apache.maven.plugin.registry.Plugin();
-
-            plugin.setGroupId( aGroupId );
-            plugin.setArtifactId( anArtifactId );
-            plugin.setUseVersion( aVersion );
-
-            pluginRegistry.addPlugin( plugin );
-
-            pluginRegistry.flushPluginsByKey();
-        }
-
-        writeUserRegistry( aGroupId, anArtifactId, pluginRegistry );
-    }
-
-    /**
-     * @param aGroupId not null
-     * @param anArtifactId not null
-     * @param pluginRegistry not null
-     */
-    private void writeUserRegistry( String aGroupId, String anArtifactId, PluginRegistry
pluginRegistry )
-    {
-        File pluginRegistryFile = pluginRegistry.getRuntimeInfo().getFile();
-
-        PluginRegistry extractedUserRegistry = PluginRegistryUtils.extractUserPluginRegistry(
pluginRegistry );
-
-        // only rewrite the user-level registry if one existed before, or if we've created
user-level data here.
-        if ( extractedUserRegistry != null )
-        {
-            Writer fWriter = null;
-
-            try
-            {
-                pluginRegistryFile.getParentFile().mkdirs();
-                fWriter = WriterFactory.newXmlWriter( pluginRegistryFile );
-
-                PluginRegistryXpp3Writer writer = new PluginRegistryXpp3Writer();
-
-                writer.write( fWriter, extractedUserRegistry );
-            }
-            catch ( IOException e )
-            {
-                getLog().warn( "Cannot rewrite user-level plugin-registry.xml with new plugin
version of plugin: \'"
-                    + aGroupId + ":" + anArtifactId + "\'.", e );
-            }
-            finally
-            {
-                IOUtil.close( fWriter );
-            }
-        }
-    }
-
-    /**
-     * @param aGroupId not null
-     * @param anArtifactId not null
-     * @return the plugin registry instance
-     * @throws IOException if any
-     * @throws XmlPullParserException if any
-     */
-    private PluginRegistry getPluginRegistry( String aGroupId, String anArtifactId )
-        throws IOException, XmlPullParserException
-    {
-        PluginRegistry pluginRegistry = null;
-
-        pluginRegistry = pluginRegistryBuilder.buildPluginRegistry();
-
-        if ( pluginRegistry == null )
-        {
-            pluginRegistry = pluginRegistryBuilder.createUserPluginRegistry();
-        }
-
-        return pluginRegistry;
-    }
-}
diff --git a/maven-plugin-plugin/src/site/apt/index.apt b/maven-plugin-plugin/src/site/apt/index.apt
index 61f554c..eb13bc3 100644
--- a/maven-plugin-plugin/src/site/apt/index.apt
+++ b/maven-plugin-plugin/src/site/apt/index.apt
@@ -30,8 +30,7 @@ Maven Plugin Plugin
 
  The Maven Plugin Plugin is used to create a {{{/ref/current/maven-plugin-api/plugin.html}Maven
plugin descriptor}} for any
  {{{/general.html#What_is_a_Mojo}Mojo}}'s found in the source tree, to include in the JAR.
- It is also used to generate report files for the Mojos as well as for updating the plugin
registry, the artifact
- metadata and generating a generic help goal.
+ It is also used to generate report files for the Mojos as well as the artifact metadata
and generating a generic help goal.
 
 * Goals Overview
 
@@ -42,9 +41,6 @@ Maven Plugin Plugin
    * {{{./report-mojo.html}plugin:report}} generates the plugin documentation: one overview
report
      (see {{{./plugin-info.html}example}}) and documentation for each plugin's goal (mojo),
 
-   * {{{./updateRegistry-mojo.html}plugin:updateRegistry}} updates the user plugin registry
(if it's in use) to
-      reflect the version being installed,
-
    * {{{./addPluginArtifactMetadata-mojo.html}plugin:addPluginArtifactMetadata}} injects
any plugin-specific artifact
       metadata to the project's artifact, for subsequent installation and deployment,
 
diff --git a/maven-plugin-plugin/src/site/fml/faq.fml b/maven-plugin-plugin/src/site/fml/faq.fml
deleted file mode 100644
index 8dffd15..0000000
--- a/maven-plugin-plugin/src/site/fml/faq.fml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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.
--->
-
-
-<faqs xmlns="http://maven.apache.org/FML/1.0.1"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 http://maven.apache.org/xsd/fml-1.0.1.xsd"
-  id="FAQ" title="Frequently Asked Questions">
-  <part id="General">
-    <faq id="Where is the plugin-registry.xml">
-      <question>Where is the <i>plugin-registry.xml</i>?</question>
-      <answer>
-        <p>
-          The <i>plugin-registry.xml</i> file can be found in the Maven local
repository, i.e. <i>${user.home}/.m2</i>
-          directory. It contains the list of the plugins installed in your repository including
the last version
-          installed.
-        </p>
-        <p>
-          <b>Note</b>: <i>usePluginRegistry</i> should be set to
<i>true</i> in you settings.
-        </p>
-      </answer>
-    </faq>
-  </part>
-</faqs>
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/site/site.xml b/maven-plugin-plugin/src/site/site.xml
index 343025f..367b87b 100644
--- a/maven-plugin-plugin/src/site/site.xml
+++ b/maven-plugin-plugin/src/site/site.xml
@@ -28,7 +28,6 @@ under the License.
       <item name="Introduction" href="index.html"/>
       <item name="Goals" href="plugin-info.html"/>
       <item name="Usage" href="usage.html"/>
-      <item name="FAQ" href="faq.html"/>
       <item name="Release Notes" href="jira-report.html"/>
       <!-- According to https://issues.apache.org/jira/browse/MNGSITE-152 -->
       <item name="License" href="http://www.apache.org/licenses/"/>


Mime
View raw message