You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/06/20 14:45:16 UTC

svn commit: r1494958 - /commons/sandbox/commons-gpg-plugin/trunk/src/main/java/org/apache/commons/plugins/gpg/HelpMojo.java

Author: sebb
Date: Thu Jun 20 12:45:15 2013
New Revision: 1494958

URL: http://svn.apache.org/r1494958
Log:
Automatically derive my plugin name

Modified:
    commons/sandbox/commons-gpg-plugin/trunk/src/main/java/org/apache/commons/plugins/gpg/HelpMojo.java

Modified: commons/sandbox/commons-gpg-plugin/trunk/src/main/java/org/apache/commons/plugins/gpg/HelpMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/commons-gpg-plugin/trunk/src/main/java/org/apache/commons/plugins/gpg/HelpMojo.java?rev=1494958&r1=1494957&r2=1494958&view=diff
==============================================================================
--- commons/sandbox/commons-gpg-plugin/trunk/src/main/java/org/apache/commons/plugins/gpg/HelpMojo.java (original)
+++ commons/sandbox/commons-gpg-plugin/trunk/src/main/java/org/apache/commons/plugins/gpg/HelpMojo.java Thu Jun 20 12:45:15 2013
@@ -22,8 +22,10 @@ import java.lang.reflect.Field;
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.help.DescribeMojo;
+import org.apache.maven.project.MavenProject;
 
 /**
  * Help Mojo that extends the standard Maven help plugin describe goal.
@@ -33,6 +35,9 @@ import org.apache.maven.plugins.help.Des
 @Mojo (name = "help")
 public class HelpMojo extends DescribeMojo {
 
+    @Component
+    private MavenProject myProject; // Must not use same name as DescribeMojo
+
    /**
      * @throws MojoExecutionException  
      * @throws MojoFailureException 
@@ -48,7 +53,8 @@ public class HelpMojo extends DescribeMo
             if (!isAccessible) {
                 f.setAccessible(true);
             }
-            f.set(this, "org.apache.commons:commons-gpg-plugin");
+            String plugin = myProject.getGroupId() + ":" + myProject.getArtifactId();
+            f.set(this, plugin);
             super.execute();        
         } catch (Exception e) {
             throw new MojoExecutionException("Could not set up plugin details");