Skip to content

Commit 75d8ed5

Browse files
authored
[MGPG-112] serverId def value was unintentionally dropped (#80)
That caused that settings.xml could not deliver GPG passphrase as it was set up in setup-java. Plus, related IT was neutered and it did not do what it was supposed to do. This yields 3.2.1 release as 3.2.0 broke pw pickup from settings.xml --- https://issues.apache.org/jira/browse/MGPG-112
1 parent 2a11a2d commit 75d8ed5

File tree

7 files changed

+18
-26
lines changed

7 files changed

+18
-26
lines changed

pom.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ under the License.
274274
<goal>clean</goal>
275275
<goal>install</goal>
276276
</goals>
277-
<properties>
278-
<gpg.homedir>${project.build.testOutputDirectory}/gnupg</gpg.homedir>
279-
</properties>
280277
</configuration>
281278
<executions>
282279
<execution>
@@ -299,6 +296,7 @@ under the License.
299296
<configuration>
300297
<properties>
301298
<gpg.signer>gpg</gpg.signer>
299+
<gpg.homedir>${project.build.testOutputDirectory}/gnupg</gpg.homedir>
302300
</properties>
303301
</configuration>
304302
</execution>

src/it/settings.xml

+8
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ under the License.
2323
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2424
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
2525

26+
<servers>
27+
<server>
28+
<!-- is here only for sign-with-passphase-from-maven-settings IT -->
29+
<id>gpg.passphrase-sign-with-passphase-from-maven-settings</id>
30+
<passphrase>TEST</passphrase>
31+
</server>
32+
</servers>
33+
2634
</settings>

src/it/sign-with-passphase-from-maven-settings/invoker.properties

-18
This file was deleted.

src/it/sign-with-passphase-from-maven-settings/pom.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ under the License.
2222
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2323
<modelVersion>4.0.0</modelVersion>
2424

25-
<groupId>org.apache.maven.its.gpg.nma</groupId>
25+
<groupId>org.apache.maven.its.gpg.swpfmc</groupId>
2626
<artifactId>test</artifactId>
2727
<version>1.0</version>
2828
<packaging>jar</packaging>
@@ -48,6 +48,8 @@ under the License.
4848
<version>@project.version@</version>
4949
<configuration>
5050
<!-- load passphrase from settings.xml -->
51+
<!-- but not the default -->
52+
<passphraseServerId>gpg.passphrase-sign-with-passphase-from-maven-settings</passphraseServerId>
5153
</configuration>
5254
<executions>
5355
<execution>

src/it/sign-with-passphase-from-maven-settings/verify.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
var artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0")
19+
var artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/swpfmc/test/1.0")
2020

2121
var expectedFiles = [
2222
"test-1.0.pom",

src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public abstract class AbstractGpgMojo extends AbstractMojo {
121121
* variables instead.
122122
**/
123123
@Deprecated
124-
@Parameter(property = "gpg.passphrase")
124+
@Parameter(property = GPG_PASSPHRASE)
125125
private String passphrase;
126126

127127
/**
@@ -134,7 +134,7 @@ public abstract class AbstractGpgMojo extends AbstractMojo {
134134
* variables instead.
135135
**/
136136
@Deprecated
137-
@Parameter(property = "gpg.passphraseServerId")
137+
@Parameter(property = "gpg.passphraseServerId", defaultValue = GPG_PASSPHRASE)
138138
private String passphraseServerId;
139139

140140
/**
@@ -392,7 +392,7 @@ private boolean isNotBlank(String string) {
392392

393393
@Deprecated
394394
private String loadGpgPassphrase() throws MojoFailureException {
395-
if (isNotBlank(passphrase)) {
395+
if (isNotBlank(passphraseServerId)) {
396396
Server server = settings.getServer(passphraseServerId);
397397
if (server != null) {
398398
if (isNotBlank(server.getPassphrase())) {

src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java

+2
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
178178
// Execute the command line
179179
// ----------------------------------------------------------------------------
180180

181+
getLog().debug("CMD: " + cmd);
182+
181183
try {
182184
int exitCode = CommandLineUtils.executeCommandLine(cmd, in, new DefaultConsumer(), new DefaultConsumer());
183185

0 commit comments

Comments
 (0)