You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Dan Tran <da...@gmail.com> on 2010/05/27 22:29:09 UTC
Re: svn commit: r948951 - in /maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg:
AbstractGpgMojo.java GpgSigner.java
isn't it better to use File rather than String as argument type for
'executable'?
-D
On Thu, May 27, 2010 at 12:01 PM, <be...@apache.org> wrote:
> Author: bentmann
> Date: Thu May 27 19:01:26 2010
> New Revision: 948951
>
> URL: http://svn.apache.org/viewvc?rev=948951&view=rev
> Log:
> [MGPG-23] Allow gpg executable name and path to be specified
>
> Modified:
> maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java
> maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSigner.java
>
> Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java?rev=948951&r1=948950&r2=948951&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java (original)
> +++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java Thu May 27 19:01:26 2010
> @@ -72,11 +72,21 @@ public abstract class AbstractGpgMojo
> */
> private boolean interactive;
>
> + /**
> + * The path to the GnuPG executable to use for artifact signing. Defaults to either "gpg" or "gpg.exe" depending on
> + * the operating system.
> + *
> + * @parameter expression="${gpg.executable}"
> + * @since 1.1
> + */
> + private String executable;
> +
> GpgSigner newSigner( MavenProject project )
> throws MojoExecutionException, MojoFailureException
> {
> GpgSigner signer = new GpgSigner();
>
> + signer.setExecutable( executable );
> signer.setInteractive( interactive );
> signer.setKeyName( keyname );
> signer.setUseAgent( useAgent );
>
> 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=948951&r1=948950&r2=948951&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 Thu May 27 19:01:26 2010
> @@ -29,6 +29,7 @@ import java.io.InputStreamReader;
> import org.apache.maven.plugin.MojoExecutionException;
> import org.apache.maven.project.MavenProject;
> import org.codehaus.plexus.util.Os;
> +import org.codehaus.plexus.util.StringUtils;
> import org.codehaus.plexus.util.cli.CommandLineException;
> import org.codehaus.plexus.util.cli.CommandLineUtils;
> import org.codehaus.plexus.util.cli.Commandline;
> @@ -39,6 +40,8 @@ public class GpgSigner
>
> public static final String SIGNATURE_EXTENSION = ".asc";
>
> + private String executable;
> +
> private boolean useAgent;
>
> private boolean isInteractive = true;
> @@ -55,6 +58,11 @@ public class GpgSigner
>
> private File homeDir;
>
> + public void setExecutable( String executable )
> + {
> + this.executable = executable;
> + }
> +
> public void setInteractive( boolean b )
> {
> isInteractive = b;
> @@ -140,7 +148,14 @@ public class GpgSigner
>
> Commandline cmd = new Commandline();
>
> - cmd.setExecutable( "gpg" + ( Os.isFamily( Os.FAMILY_WINDOWS ) ? ".exe" : "" ) );
> + if ( StringUtils.isNotEmpty( executable ) )
> + {
> + cmd.setExecutable( executable );
> + }
> + else
> + {
> + cmd.setExecutable( "gpg" + ( Os.isFamily( Os.FAMILY_WINDOWS ) ? ".exe" : "" ) );
> + }
>
> if ( homeDir != null )
> {
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r948951 - in /maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg:
AbstractGpgMojo.java GpgSigner.java
Posted by Benjamin Bentmann <be...@udo.edu>.
Dan Tran wrote:
> isn't it better to use File rather than String as argument type for
> 'executable'?
No, I don't think so. The thing is that Maven would resolve a relative
path for a File-typed param to the project basedir, but I envision this
new parameter to also support a value like "gpg2" (besides an absolute
path) that should be resolved by the shell via PATH.
Benjamin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org