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

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


The following commit(s) were added to refs/heads/fix-build by this push:
     new e779720  Fix #322: Use forward slashes for GPG file paths on Windows
e779720 is described below

commit e779720e0effae7b025857e3d596f7d6f6a6117e
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Tue Jun 30 01:10:29 2026 +0200

    Fix #322: Use forward slashes for GPG file paths on Windows
    
    GPG in Gpg4win 5.x uses a Cygwin runtime that does not recognize Windows
    backslash paths as absolute. Paths like D:\a\...\gnupg are treated as
    relative (appended to CWD) because backslash is not a path separator in
    POSIX/Cygwin context.
    
    Replace setFile() calls with getValue(path.replace('\\', '/')) for all
    file paths passed to GPG (--homedir, --output, input file), so GPG
    receives D:/a/.../gnupg which Cygwin correctly interprets as absolute.
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
 src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java | 6 +++---
 1 file changed, 3 insertions(+), 3 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 bc2acc3..d3955ec 100644
--- a/src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
+++ b/src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
@@ -86,7 +86,7 @@ public class GpgSigner extends AbstractGpgSigner {
 
         if (homeDir != null) {
             cmd.createArg().setValue("--homedir");
-            cmd.createArg().setFile(homeDir);
+            cmd.createArg().setValue(homeDir.getAbsolutePath().replace('\\', 
'/'));
         }
 
         if (gpgVersion.isBefore(GpgVersion.parse("2.1"))) {
@@ -178,9 +178,9 @@ public class GpgSigner extends AbstractGpgSigner {
         }
 
         cmd.createArg().setValue("--output");
-        cmd.createArg().setFile(signature);
+        cmd.createArg().setValue(signature.getAbsolutePath().replace('\\', 
'/'));
 
-        cmd.createArg().setFile(file);
+        cmd.createArg().setValue(file.getAbsolutePath().replace('\\', '/'));
 
         // 
----------------------------------------------------------------------------
         // Execute the command line

Reply via email to