You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/06/12 12:57:29 UTC

[maven-gpg-plugin] branch stabilize updated: avoid temp dir

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch stabilize
in repository https://gitbox.apache.org/repos/asf/maven-gpg-plugin.git


The following commit(s) were added to refs/heads/stabilize by this push:
     new 4ffba81  avoid temp dir
4ffba81 is described below

commit 4ffba81bf6475ab7da27939581542d92db1e8661
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jun 12 14:57:20 2020 +0200

    avoid temp dir
---
 .../java/org/apache/maven/plugins/gpg/GpgSigner.java   |  2 --
 .../maven/plugins/gpg/SignAndDeployFileMojo.java       | 18 +++++++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java b/src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
index 65dd396..8049440 100644
--- a/src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
+++ b/src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
@@ -70,8 +70,6 @@ public class GpgSigner
 
         GpgVersion gpgVersion = versionParser.getGpgVersion();
 
-        getLog().debug( gpgVersion.toString() );
-
         if ( args != null )
         {
             for ( String arg : args )
diff --git a/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java b/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
index 26af783..0452012 100644
--- a/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
@@ -261,6 +261,10 @@ public class SignAndDeployFileMojo
     @Parameter( property = "files" )
     private String files;
 
+    // no pom required, so can't use project
+    @Parameter( defaultValue = "${basedir}", readonly = true )
+    private File basedir;
+    
     private void initProperties()
         throws MojoExecutionException
     {
@@ -331,17 +335,17 @@ public class SignAndDeployFileMojo
             }
             if ( pomFile != null )
             {
-                if ( !pomFile.exists() )
-                {
-                    throw new MojoExecutionException( pomFile + " doesn't exist" );
-                }
-                
                 metadata = new ProjectArtifactMetadata( artifact, pomFile );
                 artifact.addMetadata( metadata );
 
                 fileSig = signer.generateSignatureForArtifact( pomFile );
                 metadata = new AscArtifactMetadata( artifact, fileSig, true );
                 artifact.addMetadata( metadata );
+
+                if ( !pomFile.exists() )
+                {
+                    throw new MojoExecutionException( pomFile + " doesn't exist" );
+                }
             }
         }
 
@@ -559,7 +563,7 @@ public class SignAndDeployFileMojo
         Model model = generateModel();
         try 
         {
-            Path tempFile = Files.createTempFile( "mvndeploy", ".pom" );
+            Path tempFile = Files.createTempFile( basedir.toPath(), "mvndeploy", ".pom" );
             try ( OutputStream out = Files.newOutputStream( tempFile ) ) 
             {
                 new MavenXpp3Writer().write( out, model );
@@ -570,7 +574,7 @@ public class SignAndDeployFileMojo
             }
 
             File generatedPom = tempFile.toFile();
-            // generatedPom.deleteOnExit();
+            generatedPom.deleteOnExit();
 
             return generatedPom.getAbsoluteFile();
         }