[maven-gpg-plugin] branch master updated: Remove empty invoker.properties Introduce constant for gpg.passphrase Apply generics

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-gpg-plugin] branch master updated: Remove empty invoker.properties Introduce constant for gpg.passphrase Apply generics

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 814cdfa  Remove empty invoker.properties Introduce constant for gpg.passphrase Apply generics
814cdfa is described below

commit 814cdfadd734fd578e0b2b5315d9cca4988430e9
Author: rfscholte <[hidden email]>
AuthorDate: Mon Dec 2 21:41:33 2019 +0100

    Remove empty invoker.properties
    Introduce constant for gpg.passphrase
    Apply generics
---
 src/it/alternative-secret-keyring/invoker.properties  | 19 -------------------
 src/it/no-main-artifact/invoker.properties            | 19 -------------------
 src/it/sign-release/invoker.properties                | 19 -------------------
 .../invoker.properties                                | 19 -------------------
 .../apache/maven/plugins/gpg/AbstractGpgSigner.java   |  8 +++++---
 .../maven/plugins/gpg/SignAndDeployFileMojo.java      |  6 +-----
 6 files changed, 6 insertions(+), 84 deletions(-)

diff --git a/src/it/alternative-secret-keyring/invoker.properties b/src/it/alternative-secret-keyring/invoker.properties
deleted file mode 100644
index a17cc59..0000000
--- a/src/it/alternative-secret-keyring/invoker.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Windows doesn't has a gpg-executable
-#invoker.os.family = !windows
diff --git a/src/it/no-main-artifact/invoker.properties b/src/it/no-main-artifact/invoker.properties
deleted file mode 100644
index a17cc59..0000000
--- a/src/it/no-main-artifact/invoker.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Windows doesn't has a gpg-executable
-#invoker.os.family = !windows
diff --git a/src/it/sign-release/invoker.properties b/src/it/sign-release/invoker.properties
deleted file mode 100644
index a17cc59..0000000
--- a/src/it/sign-release/invoker.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Windows doesn't has a gpg-executable
-#invoker.os.family = !windows
diff --git a/src/it/sign-with-passphase-from-maven-settings/invoker.properties b/src/it/sign-with-passphase-from-maven-settings/invoker.properties
deleted file mode 100644
index a17cc59..0000000
--- a/src/it/sign-with-passphase-from-maven-settings/invoker.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Windows doesn't has a gpg-executable
-#invoker.os.family = !windows
diff --git a/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgSigner.java b/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgSigner.java
index 2de3d32..e0a9301 100644
--- a/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgSigner.java
+++ b/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgSigner.java
@@ -35,6 +35,8 @@ import org.apache.maven.project.MavenProject;
  */
 public abstract class AbstractGpgSigner
 {
+    private static final String GPG_PASSPHRASE = "gpg.passphrase";
+
     public static final String SIGNATURE_EXTENSION = ".asc";
 
     protected boolean useAgent;
@@ -229,11 +231,11 @@ public abstract class AbstractGpgSigner
 
         if ( project != null )
         {
-            pass = project.getProperties().getProperty( "gpg.passphrase" );
+            pass = project.getProperties().getProperty( GPG_PASSPHRASE );
             if ( pass == null )
             {
                 MavenProject prj2 = findReactorProject( project );
-                pass = prj2.getProperties().getProperty( "gpg.passphrase" );
+                pass = prj2.getProperties().getProperty( GPG_PASSPHRASE );
             }
         }
         if ( pass == null )
@@ -242,7 +244,7 @@ public abstract class AbstractGpgSigner
         }
         if ( project != null )
         {
-            findReactorProject( project ).getProperties().setProperty( "gpg.passphrase", pass );
+            findReactorProject( project ).getProperties().setProperty( GPG_PASSPHRASE, pass );
         }
         return pass;
     }
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 37e747d..90ce6f5 100644
--- a/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java
@@ -447,12 +447,8 @@ public class SignAndDeployFileMojo
             }
         }
 
-        List attachedArtifacts = project.getAttachedArtifacts();
-
-        for ( Object attachedArtifact : attachedArtifacts )
+        for ( Artifact attached : project.getAttachedArtifacts() )
         {
-            Artifact attached = (Artifact) attachedArtifact;
-
             fileSig = signer.generateSignatureForArtifact( attached.getFile() );
             attached = new AttachedSignedArtifact( attached, new AscArtifactMetadata( attached, fileSig, false ) );
             try