You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by da...@apache.org on 2015/01/07 00:10:50 UTC

svn commit: r1649969 - in /maven/plugins/trunk/maven-gpg-plugin/src: main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java site/apt/usage.apt.vm

Author: dantran
Date: Tue Jan  6 23:10:49 2015
New Revision: 1649969

URL: http://svn.apache.org/r1649969
Log:
[MGPG-31] add one more usage example how to discover keyname and passphrase using settings.xml

Modified:
    maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/AbstractGpgMojo.java
    maven/plugins/trunk/maven-gpg-plugin/src/site/apt/usage.apt.vm

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=1649969&r1=1649968&r2=1649969&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 Tue Jan  6 23:10:49 2015
@@ -53,7 +53,7 @@ public abstract class AbstractGpgMojo
 
     /**
      * The passphrase to use when signing. If not given, look up the value under Maven
-     * settings using server id at 'passphaseServerKey' configuration.
+     * settings using server id at 'passphraseServerKey' configuration.
      **/
     @Parameter( property = "gpg.passphrase" )
     private String passphrase;

Modified: maven/plugins/trunk/maven-gpg-plugin/src/site/apt/usage.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/site/apt/usage.apt.vm?rev=1649969&r1=1649968&r2=1649969&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/site/apt/usage.apt.vm (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/site/apt/usage.apt.vm Tue Jan  6 23:10:49 2015
@@ -81,7 +81,7 @@ mvn release:perform -Darguments=-Dgpg.pa
 
 * Configure passphase under settings.xml
 
-  Instead of specifying the passphase at command line, you can place it under your local settings.xml
+  Instead of specifying the passphrase at command line, you can place it under your local settings.xml
   either in clear or {{{http://maven.apache.org/guides/mini/guide-encryption.html}encrypted}} text.
 
 +----------+
@@ -90,9 +90,73 @@ mvn release:perform -Darguments=-Dgpg.pa
   <servers>
     [...]
     <server>
-      <id>gpg.passphase</id>
-      <passphase>clear or encrypted text</passphase>
+      <id>gpg.passphrase</id>
+      <passphrase>clear or encrypted text</passphrase>
     </server>
   </servers>
 </settings>
++----------+
+
+* Configure passphase under settings.xml with a  keyname
+
+  To allow discovery of keyname and passphrase at build time, configure this plugin to map both <keyname> and <passphraseServerKey> to
+  a fixed property
+
+
++----------+
+<project>
+  ...
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-gpg-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>sign-artifacts</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>sign</goal>
+            </goals>
+            <configuration>
+              <keyname>${gpg.keyname}</keyname>
+              <passphraseServerKey>${gpg.keyname}</passphraseServerKey>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  ...
+</project>
++----------+
+
+
+  and use local settings.xml to discover the passphrase via the key name
+
++----------+
+<settings>
+  [...]
+  <servers>
+    [...]
+    <server>
+      <id>your.keyname</id>
+      <passphrase>clear or encrypted text</passphrase>
+    </server>
+  </servers>
+
+  [...]
+  <profiles>
+    <profile>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <gpg.keyname>your.keyname</gpg.keyname>
+      </properties>
+    </profile>
+  <profiles>
+
+</settings>
 +----------+
\ No newline at end of file