Skip to content

Commit

Permalink
[MGPG-112] serverId def value was unintentionally dropped (#80)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cstamas authored Mar 15, 2024
1 parent 2a11a2d commit 75d8ed5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 26 deletions.
4 changes: 1 addition & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,6 @@ under the License.
<goal>clean</goal>
<goal>install</goal>
</goals>
<properties>
<gpg.homedir>${project.build.testOutputDirectory}/gnupg</gpg.homedir>
</properties>
</configuration>
<executions>
<execution>
Expand All @@ -299,6 +296,7 @@ under the License.
<configuration>
<properties>
<gpg.signer>gpg</gpg.signer>
<gpg.homedir>${project.build.testOutputDirectory}/gnupg</gpg.homedir>
</properties>
</configuration>
</execution>
Expand Down
8 changes: 8 additions & 0 deletions src/it/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@ under the License.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<servers>
<server>
<!-- is here only for sign-with-passphase-from-maven-settings IT -->
<id>gpg.passphrase-sign-with-passphase-from-maven-settings</id>
<passphrase>TEST</passphrase>
</server>
</servers>

</settings>
18 changes: 0 additions & 18 deletions src/it/sign-with-passphase-from-maven-settings/invoker.properties

This file was deleted.

4 changes: 3 additions & 1 deletion src/it/sign-with-passphase-from-maven-settings/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.gpg.nma</groupId>
<groupId>org.apache.maven.its.gpg.swpfmc</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
Expand All @@ -48,6 +48,8 @@ under the License.
<version>@project.version@</version>
<configuration>
<!-- load passphrase from settings.xml -->
<!-- but not the default -->
<passphraseServerId>gpg.passphrase-sign-with-passphase-from-maven-settings</passphraseServerId>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
var artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/nma/test/1.0")
var artifactDir = new File(localRepositoryPath, "org/apache/maven/its/gpg/swpfmc/test/1.0")

var expectedFiles = [
"test-1.0.pom",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public abstract class AbstractGpgMojo extends AbstractMojo {
* variables instead.
**/
@Deprecated
@Parameter(property = "gpg.passphrase")
@Parameter(property = GPG_PASSPHRASE)
private String passphrase;

/**
Expand All @@ -134,7 +134,7 @@ public abstract class AbstractGpgMojo extends AbstractMojo {
* variables instead.
**/
@Deprecated
@Parameter(property = "gpg.passphraseServerId")
@Parameter(property = "gpg.passphraseServerId", defaultValue = GPG_PASSPHRASE)
private String passphraseServerId;

/**
Expand Down Expand Up @@ -392,7 +392,7 @@ private boolean isNotBlank(String string) {

@Deprecated
private String loadGpgPassphrase() throws MojoFailureException {
if (isNotBlank(passphrase)) {
if (isNotBlank(passphraseServerId)) {
Server server = settings.getServer(passphraseServerId);
if (server != null) {
if (isNotBlank(server.getPassphrase())) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
// Execute the command line
// ----------------------------------------------------------------------------

getLog().debug("CMD: " + cmd);

try {
int exitCode = CommandLineUtils.executeCommandLine(cmd, in, new DefaultConsumer(), new DefaultConsumer());

Expand Down

0 comments on commit 75d8ed5

Please sign in to comment.