You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/08/29 04:47:29 UTC

svn commit: r437917 - in /geronimo/genesis/trunk/plugins/tools-maven-plugin/src: main/java/org/apache/geronimo/genesis/plugins/tools/GpgSignAttachedMojo.java site/apt/usage.apt

Author: jdillon
Date: Mon Aug 28 19:47:29 2006
New Revision: 437917

URL: http://svn.apache.org/viewvc?rev=437917&view=rev
Log:
Change to MojoSupport, this does not need Ant
Change phase to verify, which is after package and will allow assemblies to work

Modified:
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/GpgSignAttachedMojo.java
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt

Modified: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/GpgSignAttachedMojo.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/GpgSignAttachedMojo.java?rev=437917&r1=437916&r2=437917&view=diff
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/GpgSignAttachedMojo.java (original)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/GpgSignAttachedMojo.java Mon Aug 28 19:47:29 2006
@@ -27,13 +27,12 @@
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
-import org.apache.geronimo.genesis.AntMojoSupport;
-
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.commons.lang.SystemUtils;
+import org.apache.geronimo.plugin.MojoSupport;
 
 import org.codehaus.plexus.util.cli.Commandline;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
@@ -44,13 +43,17 @@
  * Sign project attached artifacts with GnuPG.
  *
  * @goal gpg-sign-attached
- * @phase package
+ * @phase verify
  *
  * @version $Rev$ $Date$
  */
 public class GpgSignAttachedMojo
-    extends AntMojoSupport
+    extends MojoSupport
 {
+    //
+    // TODO: Pull the passphrase from settings
+    //
+    
     /**
      * The passphrase to use when signing.
      *
@@ -60,18 +63,6 @@
     private String passphrase = null;
 
     /**
-     * Maven ProjectHelper
-     *
-     * @component
-     * @readonly
-     */
-    private MavenProjectHelper projectHelper = null;
-
-    //
-    // MojoSupport Hooks
-    //
-
-    /**
      * The maven project.
      *
      * @parameter expression="${project}"
@@ -80,9 +71,13 @@
      */
     protected MavenProject project = null;
 
-    protected MavenProject getProject() {
-        return project;
-    }
+    /**
+     * Maven ProjectHelper
+     *
+     * @component
+     * @readonly
+     */
+    private MavenProjectHelper projectHelper = null;
 
     //
     // Mojo
@@ -97,28 +92,26 @@
             log.info("Artifacts to be signed: " + artifacts);
         }
 
+        // Sign attached artifacts
         Iterator iter = artifacts.iterator();
         while (iter.hasNext()) {
             Artifact artifact = (Artifact)iter.next();
-            File signature = sign(artifact);
+            File file = artifact.getFile();
 
-            if (signature != null) {
-                projectHelper.attachArtifact(project, artifact.getType() + ".asc", null, signature);
+            if (file == null) {
+                log.info("No file to sign for artifact: " + artifact);
+                continue;
             }
+
+            File signature = sign(file);
+            projectHelper.attachArtifact(project, artifact.getType() + ".asc", signature);
         }
     }
 
-    private File sign(final Artifact artifact) throws Exception {
-        assert artifact != null;
+    private File sign(final File file) throws Exception {
+        assert file != null;
 
-        File file = artifact.getFile();
-        if (file == null) {
-            log.info("No file to sign for artifact: " + artifact);
-            return null;
-        }
-        else {
-            log.info("Signing artifact file: " + file);
-        }
+        log.info("Signing artifact file: " + file);
 
         File signature = new File(file.getCanonicalPath() + ".asc");
         log.debug("Signature file: " + signature);

Modified: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt?rev=437917&r1=437916&r2=437917&view=diff
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt (original)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt Mon Aug 28 19:47:29 2006
@@ -123,7 +123,7 @@
     <executions>
         <execution>
             <id>sign-artifacts</id>
-            <phase>package</phase>
+            <phase>verify</phase>
             <goals>
                 <goal>gpg-sign-attached</goal>
             </goals>