You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/09/02 19:19:27 UTC

svn commit: r810620 - in /maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg: AscArtifactMetadata.java GpgSignAttachedMojo.java GpgSigner.java SignAndDeployFileMojo.java SigningBundle.java

Author: bentmann
Date: Wed Sep  2 17:19:27 2009
New Revision: 810620

URL: http://svn.apache.org/viewvc?rev=810620&view=rev
Log:
o Formatted code

Modified:
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SigningBundle.java

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java?rev=810620&r1=810619&r2=810620&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AscArtifactMetadata.java Wed Sep  2 17:19:27 2009
@@ -29,44 +29,43 @@
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
 import org.codehaus.plexus.util.FileUtils;
 
-public class AscArtifactMetadata extends AbstractArtifactMetadata
+public class AscArtifactMetadata
+    extends AbstractArtifactMetadata
 {
+
     File file;
+
     boolean isPom;
-    
-    public AscArtifactMetadata( Artifact artifact,
-                               File file,
-                               boolean isPom )
+
+    public AscArtifactMetadata( Artifact artifact, File file, boolean isPom )
     {
         super( artifact );
         this.file = file;
         this.isPom = isPom;
     }
 
-    public String getBaseVersion() 
+    public String getBaseVersion()
     {
         return artifact.getBaseVersion();
     }
 
-    public Object getKey() 
+    public Object getKey()
     {
-        return "gpg signature " + artifact.getGroupId() + ":" + artifact.getArtifactId() 
-            + ":" + artifact.getType() + ":" + artifact.getClassifier() +
-            (isPom ? ":pom" : "");
+        return "gpg signature " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getType()
+            + ":" + artifact.getClassifier() + ( isPom ? ":pom" : "" );
     }
-    
+
     private String getFilename()
     {
         StringBuffer buf = new StringBuffer( getArtifactId() );
         buf.append( "-" ).append( artifact.getVersion() );
-        if ( isPom ) 
+        if ( isPom )
         {
             buf.append( ".pom" );
-        } 
+        }
         else
         {
-            if ( artifact.getClassifier() != null
-                 && !"".equals( artifact.getClassifier() ) )
+            if ( artifact.getClassifier() != null && !"".equals( artifact.getClassifier() ) )
             {
                 buf.append( "-" ).append( artifact.getClassifier() );
             }
@@ -86,22 +85,21 @@
         return getFilename();
     }
 
-    public void merge( ArtifactMetadata metadata ) 
+    public void merge( ArtifactMetadata metadata )
     {
         AscArtifactMetadata m = (AscArtifactMetadata) metadata;
         if ( !m.file.equals( file ) )
         {
-            throw new IllegalStateException( "Cannot add two different pieces of metadata for: "
-                                             + getKey() );
+            throw new IllegalStateException( "Cannot add two different pieces of metadata for: " + getKey() );
         }
     }
 
-    public void storeInLocalRepository( ArtifactRepository localRepository,
-                                       ArtifactRepository remoteRepository )
-        throws RepositoryMetadataStoreException 
+    public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository )
+        throws RepositoryMetadataStoreException
     {
-        File destination = new File( localRepository.getBasedir(),
-                                     localRepository.pathOfLocalRepositoryMetadata( this, remoteRepository ) );
+        File destination =
+            new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( this,
+                                                                                                   remoteRepository ) );
 
         try
         {
@@ -113,7 +111,7 @@
         }
     }
 
-    public boolean storedInArtifactVersionDirectory() 
+    public boolean storedInArtifactVersionDirectory()
     {
         return true;
     }
@@ -122,4 +120,5 @@
     {
         return getFilename();
     }
+
 }

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java?rev=810620&r1=810619&r2=810620&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java Wed Sep  2 17:19:27 2009
@@ -41,7 +41,7 @@
 
 /**
  * Sign project artifact, the POM, and attached artifacts with GnuPG for deployment.
- *
+ * 
  * @author Jason van Zyl
  * @author Jason Dillon
  * @author Daniel Kulp
@@ -51,36 +51,32 @@
 public class GpgSignAttachedMojo
     extends AbstractMojo
 {
-    private static final String DEFAULT_EXCLUDES[] = new String[] {
-        "**/*.md5",
-        "**/*.sha1",
-        "**/*.asc"
-    };
+
+    private static final String DEFAULT_EXCLUDES[] = new String[] { "**/*.md5", "**/*.sha1", "**/*.asc" };
 
     /**
      * The passphrase to use when signing.
-     *
+     * 
      * @parameter expression="${gpg.passphrase}"
      */
     private String passphrase;
 
     /**
-     * The "name" of the key to sign with.  Passed to gpg as --local-user.
+     * The "name" of the key to sign with. Passed to gpg as --local-user.
      * 
      * @parameter expression="${gpg.keyname}"
      */
     private String keyname;
 
-
     /**
-     * Passes --use-agent or --no-use-agent to gpg.   If using an agent,
-     * the password is optional as the agent will provide it.
+     * Passes --use-agent or --no-use-agent to gpg. If using an agent, the password is optional as the agent will
+     * provide it.
      * 
      * @parameter expression="${gpg.useagent}" default-value="false"
      * @required
      */
     private boolean useAgent;
-    
+
     /**
      * Skip doing the gpg signing
      * 
@@ -89,11 +85,9 @@
      */
     private boolean skip;
 
-    
     /**
-     * A list of files to exclude from being signed. Can contain ant-style 
-     * wildcards and double wildcards. The default excludes are
-     * <code>**&#47;*.md5   **&#47;*.sha1    **&#47;*.asc</code>.
+     * A list of files to exclude from being signed. Can contain ant-style wildcards and double wildcards. The default
+     * excludes are <code>**&#47;*.md5   **&#47;*.sha1    **&#47;*.asc</code>.
      * 
      * @parameter
      * @since 1.0-alpha-4
@@ -102,15 +96,15 @@
 
     /**
      * The directory where to store signature files.
-     *
+     * 
      * @parameter expression="${project.build.directory}/gpg"
      * @since 1.0-alpha-4
      */
     private File outputDirectory;
-    
+
     /**
      * The maven project.
-     *
+     * 
      * @parameter expression="${project}"
      * @required
      * @readonly
@@ -119,7 +113,7 @@
 
     /**
      * Maven ProjectHelper
-     *
+     * 
      * @component
      * @required
      * @readonly
@@ -128,35 +122,33 @@
 
     /**
      * Maven ArtifactHandlerManager
-     *
+     * 
      * @component
      * @required
      * @readonly
      */
     private ArtifactHandlerManager artifactHandlerManager;
-    
+
     /**
      * @parameter expression="${settings}"
      * @required
      * @readonly
      */
     protected Settings settings;
-    
-    
-    private GpgSigner signer = new GpgSigner();
 
+    private GpgSigner signer = new GpgSigner();
 
     public void execute()
         throws MojoExecutionException
     {
 
         String pass = passphrase;
-        if ( skip ) 
+        if ( skip )
         {
-            //We're skipping the signing stuff
+            // We're skipping the signing stuff
             return;
         }
-        
+
         if ( excludes == null || excludes.length == 0 )
         {
             excludes = DEFAULT_EXCLUDES;
@@ -165,8 +157,7 @@
         for ( int i = 0; i < excludes.length; i++ )
         {
             String pattern;
-            pattern = excludes[i].trim().replace( '/', File.separatorChar ).replace(
-                '\\', File.separatorChar );
+            pattern = excludes[i].trim().replace( '/', File.separatorChar ).replace( '\\', File.separatorChar );
             if ( pattern.endsWith( File.separator ) )
             {
                 pattern += "**";
@@ -174,25 +165,23 @@
             newExcludes[i] = pattern;
         }
         excludes = newExcludes;
-        
-        
+
         if ( !useAgent && null == pass )
         {
             if ( !settings.isInteractiveMode() )
             {
-                throw new MojoExecutionException("Cannot obtain passphrase in batch mode");
+                throw new MojoExecutionException( "Cannot obtain passphrase in batch mode" );
             }
-            try 
+            try
             {
-                pass = signer.getPassphrase(project);
+                pass = signer.getPassphrase( project );
             }
-            catch (IOException e) 
+            catch ( IOException e )
             {
-                throw new MojoExecutionException("Exception reading password", e);
+                throw new MojoExecutionException( "Exception reading password", e );
             }
         }
-        
-        
+
         // ----------------------------------------------------------------------------
         // What we need to generateSignatureForArtifact here
         // ----------------------------------------------------------------------------
@@ -203,7 +192,7 @@
         signer.setOutputDirectory( outputDirectory );
         signer.setBuildDirectory( new File( project.getBuild().getDirectory() ) );
         signer.setBaseDirectory( project.getBasedir() );
-        
+
         List signingBundles = new ArrayList();
 
         if ( !"pom".equals( project.getPackaging() ) )
@@ -280,8 +269,7 @@
 
             ArtifactHandler ah = artifactHandlerManager.getArtifactHandler( bundle.getArtifactType() );
 
-            if ( bundle.getClassifier() != null 
-                && !"".equals( bundle.getClassifier() ) )
+            if ( bundle.getClassifier() != null && !"".equals( bundle.getClassifier() ) )
             {
                 projectHelper.attachArtifact( project, "asc", bundle.getClassifier() + "." + ah.getExtension(),
                                               bundle.getSignature() );
@@ -292,14 +280,13 @@
             }
         }
     }
-    
+
     /**
-     * Tests whether or not a name matches against at least one exclude
-     * pattern.
-     *
+     * Tests whether or not a name matches against at least one exclude pattern.
+     * 
      * @param name The name to match. Must not be <code>null</code>.
-     * @return <code>true</code> when the name matches against at least one
-     *         exclude pattern, or <code>false</code> otherwise.
+     * @return <code>true</code> when the name matches against at least one exclude pattern, or <code>false</code>
+     *         otherwise.
      */
     protected boolean isExcluded( String name )
     {
@@ -312,5 +299,5 @@
         }
         return false;
     }
-    
+
 }

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java?rev=810620&r1=810619&r2=810620&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java Wed Sep  2 17:19:27 2009
@@ -34,75 +34,79 @@
 import org.codehaus.plexus.util.cli.Commandline;
 import org.codehaus.plexus.util.cli.DefaultConsumer;
 
-public class GpgSigner 
+public class GpgSigner
 {
+
     public static final String SIGNATURE_EXTENSION = ".asc";
-    
-    
+
     private boolean useAgent;
+
     private boolean isInteractive = true;
+
     private String keyname;
+
     private File outputDir;
+
     private File buildDir;
+
     private File baseDir;
-    
+
     public GpgSigner()
     {
     }
-    
-    
-    public void setInteractive(boolean b)
+
+    public void setInteractive( boolean b )
     {
         isInteractive = b;
     }
-    
-    public void setUseAgent(boolean b)
+
+    public void setUseAgent( boolean b )
     {
         useAgent = b;
     }
-    
-    public void setKeyName(String s) 
+
+    public void setKeyName( String s )
     {
         keyname = s;
     }
-    
-    public void setOutputDirectory(File out) 
+
+    public void setOutputDirectory( File out )
     {
         outputDir = out;
     }
-    public void setBuildDirectory(File out) 
+
+    public void setBuildDirectory( File out )
     {
         buildDir = out;
     }
-    public void setBaseDirectory(File out) 
+
+    public void setBaseDirectory( File out )
     {
         baseDir = out;
     }
-    
-    
-    public File generateSignatureForArtifact( File file , String pass)
+
+    public File generateSignatureForArtifact( File file, String pass )
         throws MojoExecutionException
     {
         File signature = new File( file + SIGNATURE_EXTENSION );
-    
+
         boolean isInBuildDir = false;
         if ( buildDir != null )
         {
             File parent = signature.getParentFile();
-            if ( buildDir.equals(parent) ) 
+            if ( buildDir.equals( parent ) )
             {
                 isInBuildDir = true;
             }
         }
-        if ( !isInBuildDir
-            && outputDir != null ) 
+        if ( !isInBuildDir && outputDir != null )
         {
             String fileDirectory = "";
             File signatureDirectory = signature;
-            
-            while( ( signatureDirectory = signatureDirectory.getParentFile() ) != null )
+
+            while ( ( signatureDirectory = signatureDirectory.getParentFile() ) != null )
             {
-                if( !signatureDirectory.equals( baseDir ) )
+                if ( !signatureDirectory.equals( baseDir ) )
                 {
                     fileDirectory = signatureDirectory.getName() + File.separatorChar + fileDirectory;
                 }
@@ -112,22 +116,22 @@
                 }
             }
             signatureDirectory = new File( outputDir, fileDirectory );
-            if( !signatureDirectory.exists() )
+            if ( !signatureDirectory.exists() )
             {
                 signatureDirectory.mkdirs();
             }
             signature = new File( signatureDirectory, file.getName() + SIGNATURE_EXTENSION );
         }
-        
+
         if ( signature.exists() )
         {
             signature.delete();
         }
-        
+
         Commandline cmd = new Commandline();
-    
+
         cmd.setExecutable( "gpg" + ( SystemUtils.IS_OS_WINDOWS ? ".exe" : "" ) );
-    
+
         if ( useAgent )
         {
             cmd.createArg().setValue( "--use-agent" );
@@ -136,44 +140,43 @@
         {
             cmd.createArg().setValue( "--no-use-agent" );
         }
-    
+
         InputStream in = null;
-        if ( null != pass) 
+        if ( null != pass )
         {
             cmd.createArg().setValue( "--passphrase-fd" );
-    
+
             cmd.createArg().setValue( "0" );
-    
+
             // Prepare the input stream which will be used to pass the passphrase to the executable
             in = new ByteArrayInputStream( pass.getBytes() );
         }
-    
-        if ( null != keyname)
+
+        if ( null != keyname )
         {
             cmd.createArg().setValue( "--local-user" );
-    
+
             cmd.createArg().setValue( keyname );
         }
-    
+
         cmd.createArg().setValue( "--armor" );
-    
+
         cmd.createArg().setValue( "--detach-sign" );
-        
+
         if ( !isInteractive )
         {
             cmd.createArg().setValue( "--no-tty" );
         }
-        
+
         cmd.createArg().setValue( "--output" );
         cmd.createArg().setFile( signature );
-        
+
         cmd.createArg().setFile( file );
-    
-    
+
         try
         {
             int exitCode = CommandLineUtils.executeCommandLine( cmd, in, new DefaultConsumer(), new DefaultConsumer() );
-    
+
             if ( exitCode != 0 )
             {
                 throw new MojoExecutionException( "Exit code: " + exitCode );
@@ -183,12 +186,12 @@
         {
             throw new MojoExecutionException( "Unable to execute gpg command", e );
         }
-    
+
         return signature;
     }
-    
-    
-    private MavenProject findReactorProject(MavenProject prj) {
+
+    private MavenProject findReactorProject( MavenProject prj )
+    {
         if ( prj.getParent() != null )
         {
             if ( prj.getParent().getBasedir() != null && prj.getParent().getBasedir().exists() )
@@ -198,77 +201,79 @@
         }
         return prj;
     }
-    
-    
-    public String getPassphrase(MavenProject project) throws IOException
+
+    public String getPassphrase( MavenProject project )
+        throws IOException
     {
         String pass = null;
-        
-        if (project != null) {
-            pass = project.getProperties().getProperty("gpg.passphrase");
-            if (pass == null) 
+
+        if ( project != null )
+        {
+            pass = project.getProperties().getProperty( "gpg.passphrase" );
+            if ( pass == null )
             {
-                MavenProject prj2 = findReactorProject(project);
-                pass = prj2.getProperties().getProperty("gpg.passphrase");
+                MavenProject prj2 = findReactorProject( project );
+                pass = prj2.getProperties().getProperty( "gpg.passphrase" );
             }
         }
-        if (pass == null) 
+        if ( pass == null )
         {
-            //TODO: with JDK 1.6, we could call System.console().readPassword("GPG Passphrase: ", null);
-            
-            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
-            while (System.in.available() != 0)
+            // TODO: with JDK 1.6, we could call System.console().readPassword("GPG Passphrase: ", null);
+
+            BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
+            while ( System.in.available() != 0 )
             {
-                //there's some junk already on the input stream, consume it
-                //so we can get the real passphrase
+                // there's some junk already on the input stream, consume it
+                // so we can get the real passphrase
                 System.in.read();
             }
-            
-            System.out.print("GPG Passphrase:  ");
+
+            System.out.print( "GPG Passphrase:  " );
             MaskingThread thread = new MaskingThread();
             thread.start();
-    
-    
+
             pass = in.readLine();
-    
+
             // stop masking
             thread.stopMasking();
         }
-        if (project != null) {
-            findReactorProject(project).getProperties().setProperty("gpg.passphrase", pass);
+        if ( project != null )
+        {
+            findReactorProject( project ).getProperties().setProperty( "gpg.passphrase", pass );
         }
         return pass;
     }
-    
-    
+
     // based on ideas from http://java.sun.com/developer/technicalArticles/Security/pwordmask/
-    class MaskingThread extends Thread
+    class MaskingThread
+        extends Thread
     {
         private volatile boolean stop;
 
-       /**
-        * Begin masking until asked to stop.
-        */
+        /**
+         * Begin masking until asked to stop.
+         */
         public void run()
         {
-            //this needs to be high priority to make sure the characters don't
-            //really get to the screen.
-            
+            // this needs to be high priority to make sure the characters don't
+            // really get to the screen.
+
             int priority = Thread.currentThread().getPriority();
-            Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
+            Thread.currentThread().setPriority( Thread.MAX_PRIORITY );
 
-            try {
+            try
+            {
                 stop = false;
-                while(!stop)
-                { 
-                    //print a backspace + * to overwrite anything they type
-                    System.out.print("\010*");
+                while ( !stop )
+                {
+                    // print a backspace + * to overwrite anything they type
+                    System.out.print( "\010*" );
                     try
                     {
-                        //attempt masking at this rate
-                        Thread.sleep(1);
+                        // attempt masking at this rate
+                        Thread.sleep( 1 );
                     }
-                    catch (InterruptedException iex)
+                    catch ( InterruptedException iex )
                     {
                         Thread.currentThread().interrupt();
                         return;
@@ -278,17 +283,17 @@
             finally
             {
                 // restore the original priority
-                Thread.currentThread().setPriority(priority);
+                Thread.currentThread().setPriority( priority );
             }
         }
 
         /**
          * Instruct the thread to stop masking.
          */
-        public void stopMasking() {
+        public void stopMasking()
+        {
             this.stop = true;
         }
-    }    
-    
+    }
 
 }

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java?rev=810620&r1=810619&r2=810620&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java Wed Sep  2 17:19:27 2009
@@ -22,10 +22,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Field;
-import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
@@ -40,7 +37,6 @@
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.deploy.DeployFileMojo;
-import org.apache.maven.project.artifact.AttachedArtifact;
 import org.apache.maven.settings.Settings;
 
 /**
@@ -51,25 +47,27 @@
  * @requiresProject false
  * @since 1.0-beta-4
  */
-public class SignAndDeployFileMojo extends DeployFileMojo {
+public class SignAndDeployFileMojo
+    extends DeployFileMojo
+{
+
     /**
      * The passphrase to use when signing.
-     *
+     * 
      * @parameter expression="${gpg.passphrase}"
      */
     private String passphrase;
 
     /**
-     * The "name" of the key to sign with.  Passed to gpg as --local-user.
+     * The "name" of the key to sign with. Passed to gpg as --local-user.
      * 
      * @parameter expression="${gpg.keyname}"
      */
     private String keyname;
 
-
     /**
-     * Passes --use-agent or --no-use-agent to gpg.   If using an agent,
-     * the password is optional as the agent will provide it.
+     * Passes --use-agent or --no-use-agent to gpg. If using an agent, the password is optional as the agent will
+     * provide it.
      * 
      * @parameter expression="${gpg.useagent}" default-value="false"
      * @required
@@ -78,188 +76,193 @@
 
     /**
      * The directory where to store signature files.
-     *
+     * 
      * @parameter expression="${gpg.asc.directory}"
      */
     private File ascDirectory;
-    
-    
+
     /**
      * @parameter expression="${settings}"
      * @required
      * @readonly
      */
     protected Settings settings;
-    
-    
+
     /**
      * Maven ArtifactHandlerManager
-     *
+     * 
      * @component
      * @required
      * @readonly
      */
     private ArtifactHandlerManager artifactHandlerManager;
-    
-    
-    /* stuff I need to copy since the plugin:plugin doesn't support inheritance outside
-     * the current jar
+
+    /*
+     * stuff I need to copy since the plugin:plugin doesn't support inheritance outside the current jar
      */
     /**
      * @component
      */
     private ArtifactDeployer deployer;
+
     /**
      * @parameter expression="${localRepository}"
      * @required
      * @readonly
      */
     private ArtifactRepository localRepository;
+
     /**
-     * GroupId of the artifact to be deployed.  Retrieved from POM file if specified.
-     *
+     * GroupId of the artifact to be deployed. Retrieved from POM file if specified.
+     * 
      * @parameter expression="${groupId}"
      */
     private String groupId;
+
     /**
-     * ArtifactId of the artifact to be deployed.  Retrieved from POM file if specified.
-     *
+     * ArtifactId of the artifact to be deployed. Retrieved from POM file if specified.
+     * 
      * @parameter expression="${artifactId}"
      */
     private String artifactId;
+
     /**
-     * Version of the artifact to be deployed.  Retrieved from POM file if specified.
-     *
+     * Version of the artifact to be deployed. Retrieved from POM file if specified.
+     * 
      * @parameter expression="${version}"
      */
     private String version;
+
     /**
-     * Type of the artifact to be deployed.  Retrieved from POM file if specified.
-     *
+     * Type of the artifact to be deployed. Retrieved from POM file if specified.
+     * 
      * @parameter expression="${packaging}"
      */
     private String packaging;
+
     /**
      * Description passed to a generated POM file (in case of generatePom=true)
-     *
+     * 
      * @parameter expression="${generatePom.description}"
      */
     private String description;
+
     /**
      * File to be deployed.
-     *
+     * 
      * @parameter expression="${file}"
      * @required
      */
     private File file;
+
     /**
-     * Server Id to map on the &lt;id&gt; under &lt;server&gt; section of settings.xml
-     * In most cases, this parameter will be required for authentication.
-     *
+     * Server Id to map on the &lt;id&gt; under &lt;server&gt; section of settings.xml In most cases, this parameter
+     * will be required for authentication.
+     * 
      * @parameter expression="${repositoryId}" default-value="remote-repository"
      * @required
      */
     private String repositoryId;
+
     /**
-     * The type of remote repository layout to deploy to. Try <i>legacy</i> for 
-     * a Maven 1.x-style repository layout.
+     * The type of remote repository layout to deploy to. Try <i>legacy</i> for a Maven 1.x-style repository layout.
      * 
      * @parameter expression="${repositoryLayout}" default-value="default"
      * @required
      */
     private String repositoryLayout;
+
     /**
      * Map that contains the layouts
-     *
+     * 
      * @component role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
      */
     private Map repositoryLayouts;
+
     /**
      * URL where the artifact will be deployed. <br/>
      * ie ( file://C:\m2-repo or scp://host.com/path/to/repo )
-     *
+     * 
      * @parameter expression="${url}"
      * @required
      */
     private String url;
+
     /**
      * Component used to create an artifact
-     *
+     * 
      * @component
      */
     private ArtifactFactory artifactFactory;
+
     /**
      * Component used to create a repository
-     *
+     * 
      * @component
      */
     private ArtifactRepositoryFactory repositoryFactory;
+
     /**
-     * Location of an existing POM file to be deployed alongside the main
-     * artifact, given by the ${file} parameter.
+     * Location of an existing POM file to be deployed alongside the main artifact, given by the ${file} parameter.
      * 
      * @parameter expression="${pomFile}"
      */
     private File pomFile;
+
     /**
-     * Upload a POM for this artifact.  Will generate a default POM if none is
-     * supplied with the pomFile argument.
-     *
+     * Upload a POM for this artifact. Will generate a default POM if none is supplied with the pomFile argument.
+     * 
      * @parameter expression="${generatePom}" default-value="true"
      */
     private boolean generatePom;
+
     /**
      * Add classifier to the artifact
-     *
+     * 
      * @parameter expression="${classifier}";
      */
     private String classifier;
+
     /**
      * Whether to deploy snapshots with a unique version or not.
-     *
+     * 
      * @parameter expression="${uniqueVersion}" default-value="true"
      */
     private boolean uniqueVersion;
-    
-    
-    
-    
+
     private final GpgSigner signer = new GpgSigner();
-    
-    
-    
+
     public void execute()
-    throws MojoExecutionException
+        throws MojoExecutionException
     {
         ArtifactHandler handler = new DefaultArtifactHandler( "asc" );
         Map map = new HashMap();
         map.put( "asc", handler );
         artifactHandlerManager.addHandlers( map );
-        
-        
+
         copyToParent();
         ArtifactDeployer deployer = getDeployer();
         signer.setInteractive( settings.isInteractiveMode() );
         signer.setKeyName( keyname );
         signer.setUseAgent( useAgent );
-        signer.setOutputDirectory(ascDirectory);
-        signer.setBaseDirectory(new File("foo").getAbsoluteFile().getParentFile().getAbsoluteFile());
-        
+        signer.setOutputDirectory( ascDirectory );
+        signer.setBaseDirectory( new File( "foo" ).getAbsoluteFile().getParentFile().getAbsoluteFile() );
+
         setDeployer( new SignedArtifactDeployer( deployer, passphrase ) );
         super.execute();
     }
-    
-    /* this sucks.  The plugin:plugin won't find properties in parent classes unless 
-     * they exist in the same compilation unit.  Thus, we need to declare our own and 
-     * copy them to the parent.  HOWEVER, the DeployFileMojo doesn't have public setters.
-     * Thus, we need to do crappy field copies.
+
+    /*
+     * this sucks. The plugin:plugin won't find properties in parent classes unless they exist in the same compilation
+     * unit. Thus, we need to declare our own and copy them to the parent. HOWEVER, the DeployFileMojo doesn't have
+     * public setters. Thus, we need to do crappy field copies.
      */
     private void copyToParent()
-    throws MojoExecutionException 
+        throws MojoExecutionException
     {
         this.setDeployer( deployer );
         this.setLocalRepository( localRepository );
-        
+
         setDeployFileMojoField( "groupId", groupId );
         setDeployFileMojoField( "artifactId", artifactId );
         setDeployFileMojoField( "version", version );
@@ -277,16 +280,17 @@
         setDeployFileMojoField( "classifier", classifier );
         setDeployFileMojoField( "uniqueVersion", Boolean.valueOf( uniqueVersion ) );
     }
-    
+
     private void setDeployFileMojoField( String name, Object value )
-    throws MojoExecutionException 
+        throws MojoExecutionException
     {
-        try {
+        try
+        {
             Field f = DeployFileMojo.class.getDeclaredField( name );
             f.setAccessible( true );
             f.set( this, value );
         }
-        catch (Exception e)
+        catch ( Exception e )
         {
             throw new MojoExecutionException( "Could not set field " + name, e );
         }
@@ -303,12 +307,14 @@
         this.localRepository = localRepository;
         super.setLocalRepository( localRepository );
     }
-    
-    private class SignedArtifactDeployer implements ArtifactDeployer 
+
+    private class SignedArtifactDeployer
+        implements ArtifactDeployer
     {
         ArtifactDeployer deployer;
+
         String pass;
-        
+
         public SignedArtifactDeployer( ArtifactDeployer dep, String passphrase )
             throws MojoExecutionException
         {
@@ -320,58 +326,51 @@
                 {
                     throw new MojoExecutionException( "Cannot obtain passphrase in batch mode" );
                 }
-                try 
+                try
                 {
                     pass = signer.getPassphrase( null );
                 }
-                catch (IOException e) 
+                catch ( IOException e )
                 {
                     throw new MojoExecutionException( "Exception reading password", e );
                 }
             }
         }
 
-        public void deploy( File source, Artifact artifact,
-                           ArtifactRepository deploymentRepository,
-                           ArtifactRepository localRepository ) 
-        throws ArtifactDeploymentException 
+        public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository,
+                            ArtifactRepository localRepository )
+            throws ArtifactDeploymentException
         {
             try
             {
                 File fileSig = signer.generateSignatureForArtifact( source, pass );
                 ArtifactMetadata metadata = new AscArtifactMetadata( artifact, fileSig, false );
                 artifact.addMetadata( metadata );
-                
-                if ( !generatePom
-                    && pomFile != null )
+
+                if ( !generatePom && pomFile != null )
                 {
                     fileSig = signer.generateSignatureForArtifact( pomFile, pass );
                     metadata = new AscArtifactMetadata( artifact, fileSig, true );
                     artifact.addMetadata( metadata );
                 }
-                
+
                 deployer.deploy( source, artifact, deploymentRepository, localRepository );
             }
-            catch (MojoExecutionException e )
+            catch ( MojoExecutionException e )
             {
-                throw new ArtifactDeploymentException( e.getMessage(), e);
+                throw new ArtifactDeploymentException( e.getMessage(), e );
             }
-            
+
         }
 
-        public void deploy( String basedir, String finalName,
-                            Artifact artifact,
-                            ArtifactRepository deploymentRepository,
-                            ArtifactRepository localRepository ) 
-        throws ArtifactDeploymentException 
+        public void deploy( String basedir, String finalName, Artifact artifact,
+                            ArtifactRepository deploymentRepository, ArtifactRepository localRepository )
+            throws ArtifactDeploymentException
         {
             String extension = artifact.getArtifactHandler().getExtension();
             File source = new File( basedir, finalName + "." + extension );
             deploy( source, artifact, deploymentRepository, localRepository );
         }
     }
-    
-    
-    
 
 }

Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SigningBundle.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SigningBundle.java?rev=810620&r1=810619&r2=810620&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SigningBundle.java (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SigningBundle.java Wed Sep  2 17:19:27 2009
@@ -24,23 +24,21 @@
 /** @author Jason van Zyl */
 public class SigningBundle
 {
+
     private String artifactType;
 
     private String classifier;
 
     private File signature;
 
-    public SigningBundle( String artifactType,
-                          File signature )
+    public SigningBundle( String artifactType, File signature )
     {
         this.artifactType = artifactType;
-       
+
         this.signature = signature;
     }
 
-
-    public SigningBundle( String artifactType, String classifier,
-                          File signature )
+    public SigningBundle( String artifactType, String classifier, File signature )
     {
         this.artifactType = artifactType;
         this.classifier = classifier;
@@ -61,4 +59,5 @@
     {
         return classifier;
     }
+
 }