From commits-return-76501-archive-asf-public=cust-asf.ponee.io@maven.apache.org Mon Oct 8 13:26:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 332D5180652 for ; Mon, 8 Oct 2018 13:26:04 +0200 (CEST) Received: (qmail 19120 invoked by uid 500); 8 Oct 2018 11:26:03 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 19111 invoked by uid 99); 8 Oct 2018 11:26:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Oct 2018 11:26:03 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 9DA0482B74; Mon, 8 Oct 2018 11:26:02 +0000 (UTC) Date: Mon, 08 Oct 2018 11:26:02 +0000 To: "commits@maven.apache.org" Subject: [maven-plugin-tools] branch master updated: [MPLUGIN-332] remove plugin:updateRegistry goal, which is unused in Maven 3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <153899796259.7910.6810844968681559500@gitbox.apache.org> From: olamy@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: maven-plugin-tools X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 08dc90d432d2f81f6fe9707a038a96139284d7b5 X-Git-Newrev: 21e630f662c51a7e8e430401bb7f0a4bcb7d8066 X-Git-Rev: 21e630f662c51a7e8e430401bb7f0a4bcb7d8066 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 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 --- 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 @@ Maven Plugin Plugin 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. 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 plugin-registry.xml 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 @@ - - - - - - - - - Where is the plugin-registry.xml? - -

- The plugin-registry.xml file can be found in the Maven local repository, i.e. ${user.home}/.m2 - directory. It contains the list of the plugins installed in your repository including the last version - installed. -

-

- Note: usePluginRegistry should be set to true in you settings. -

-
-
-
-
\ 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. -