Author: dkulp
Date: Fri Apr 27 06:28:25 2007
New Revision: 533089
URL: http://svn.apache.org/viewvc?view=rev&rev=533089
Log:
[MGPG-3, MGPG-5, MGPG-6, MGPG-8]
Bunch of fixes that have been sitting on my hard disk for way too long.
Update pom to declare all depenencies explicitely.
Modified:
maven/plugins/trunk/maven-gpg-plugin/ (props changed)
maven/plugins/trunk/maven-gpg-plugin/pom.xml
maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
Propchange: maven/plugins/trunk/maven-gpg-plugin/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Apr 27 06:28:25 2007
@@ -2,3 +2,11 @@
*.iml
*.ipr
*.iws
+.settings
+.classpath
+.project
+.checkstyle
+.pmd
+.ruleset
+
+
Modified: maven/plugins/trunk/maven-gpg-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/pom.xml?view=diff&rev=533089&r1=533088&r2=533089
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-gpg-plugin/pom.xml Fri Apr 27 06:28:25 2007
@@ -20,18 +20,34 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
+ <version>2.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
- <version>2.0</version>
+ <version>2.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
- <version>2.0</version>
+ <version>2.0.5</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.2</version>
+ </dependency>
+
<dependency>
<groupId>commons-lang</groupId>
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?view=diff&rev=533089&r1=533088&r2=533089
==============================================================================
---
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
Fri Apr 27 06:28:25 2007
@@ -34,6 +34,7 @@
import org.codehaus.plexus.util.cli.Commandline;
import org.codehaus.plexus.util.cli.DefaultConsumer;
import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.SelectorUtils;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -62,6 +63,11 @@
extends AbstractMojo
{
public static final String SIGNATURE_EXTENSION = ".asc";
+ private static final String DEFAULT_EXCLUDES[] = new String[] {
+ "**/*.md5",
+ "**/*.sha1",
+ "**/*.asc"
+ };
/**
* The passphrase to use when signing.
@@ -95,6 +101,16 @@
*/
private boolean skip;
+
+ /**
+ * A list of files to exclude from being signed. Can contain ant-style
+ * wildcards and double wildcards. The default includes are
+ * <code>**/*.md5 **/*.sha1 **/*.asc</code>
+ *
+ * @parameter
+ * @since 1.0-alpha-4
+ */
+ private String[] excludes;
/**
* The maven project.
@@ -142,6 +158,25 @@
return;
}
+ if ( excludes == null || excludes.length == 0 )
+ {
+ excludes = DEFAULT_EXCLUDES;
+ }
+ String newExcludes[] = new String[excludes.length];
+ for ( int i = 0; i < excludes.length; i++ )
+ {
+ String pattern;
+ pattern = excludes[i].trim().replace( '/', File.separatorChar
).replace(
+ '\\', File.separatorChar );
+ if ( pattern.endsWith( File.separator ) )
+ {
+ pattern += "**";
+ }
+ newExcludes[i] = pattern;
+ }
+ excludes = newExcludes;
+
+
if ( !useAgent && null == pass )
{
if ( !settings.isInteractiveMode() )
@@ -175,7 +210,10 @@
File projectArtifactSignature = generateSignatureForArtifact(
projectArtifact, pass );
- signingBundles.add( new SigningBundle(
project.getArtifact().getType(), projectArtifactSignature ) );
+ if ( projectArtifactSignature != null )
+ {
+ signingBundles.add( new SigningBundle(
project.getArtifact().getType(), projectArtifactSignature ) );
+ }
}
//
----------------------------------------------------------------------------
@@ -195,7 +233,10 @@
File pomSignature = generateSignatureForArtifact( pomToSign, pass );
- signingBundles.add( new SigningBundle( "pom", pomSignature ) );
+ if ( pomSignature != null )
+ {
+ signingBundles.add( new SigningBundle( "pom", pomSignature ) );
+ }
//
----------------------------------------------------------------------------
// Attached artifacts
@@ -209,7 +250,10 @@
File signature = generateSignatureForArtifact( file, pass );
- signingBundles.add( new SigningBundle( artifact.getType(),
artifact.getClassifier(), signature ) );
+ if ( signature != null )
+ {
+ signingBundles.add( new SigningBundle( artifact.getType(),
artifact.getClassifier(), signature ) );
+ }
}
//
----------------------------------------------------------------------------
@@ -230,9 +274,9 @@
ArtifactHandler ah = artifactHandlerManager.getArtifactHandler(
bundle.getArtifactType() );
- if ( bundle.getClassifier() != null )
+ if ( bundle.getClassifier() != null
+ && !"".equals( bundle.getClassifier() ) )
{
-
projectHelper.attachArtifact( project, "asc",
bundle.getClassifier() + "." + ah.getExtension(),
bundle.getSignature() );
}
@@ -287,7 +331,12 @@
cmd.createArgument().setValue( "--armor" );
cmd.createArgument().setValue( "--detach-sign" );
-
+
+ if ( !settings.isInteractiveMode() )
+ {
+ cmd.createArgument().setValue( "--no-tty" );
+ }
+
cmd.createArgument().setFile( file );
@@ -308,15 +357,6 @@
return signature;
}
- //TODO: This must be made to work generally or the packaging plugins must
- // set the project artifact as part of what they do. We should not have to
- // guess or synthesize what project artifact is here. It should have
happened
- // already. We'll settle for JAR files right now.
- protected File getProjectFile( String basedir,
- String finalName )
- {
- return new File( basedir, finalName + ".jar" );
- }
private MavenProject findReactorProject(MavenProject prj) {
if ( prj.getParent() != null )
@@ -328,6 +368,25 @@
}
return prj;
}
+ /**
+ * 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.
+ */
+ protected boolean isExcluded( String name )
+ {
+ for ( int i = 0; i < excludes.length; i++ )
+ {
+ if ( SelectorUtils.matchPath( excludes[i], name ) )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
protected String getPassphrase() throws IOException
{
@@ -349,7 +408,7 @@
System.in.read();
}
- System.out.print("GPG Passphrase: ");
+ System.out.print("GPG Passphrase: ");
MaskingThread thread = new MaskingThread();
thread.start();