Pass in List-Parameter to Maven using the CLI (gpg:sign-and-deploy-file)

355 Views Asked by At

I'm currently stuck when deploying a single file to my Maven Registry. I use this goal to deploy to files using the command line: https://maven.apache.org/plugins/maven-gpg-plugin/sign-and-deploy-file-mojo.html

I need to pass in 2 gpgArguments:

<gpgArguments>
    <arg>--pinentry-mode</arg>
    <arg>loopback</arg>
</gpgArguments>

Otherwise the signing-process will fail, because I'm using Github Actions and I get an error, if they are not set (gpg: signing failed: Inappropriate ioctl for device)
In the MOJO of the plugin there is a parameter "gpgArguments" that is marked as "List".

Is it possible to pass in a List of parameters using the CLI? I tried a lot of stuff and also googled quite a bit and nothing seems to help.

My current command looks like this, but it is not interpreting the gpgArguments:

mvn gpg:sign-and-deploy-file -DpomFile=java/pom.xml -Dfile=./executable/exe -Durl=https://oss.sonatype.org/content/repositories/snapshots -Dclassifier=linux -DrepositoryId=ossrh -Dpackaging=exe -DgpgArguments=--pinentry-mode,loopback

If that's not possible, what are my alternatives? Thanks :)

2

There are 2 best solutions below

0
On BEST ANSWER

Turns out, that the "gpgArguments" has not "User Property", which is what you can pass through using the CLI.

After a lot of trial and error I found out a hack, which is the only solution I found for now.. Although it's not really elegant.

I created a shell file called "gpghack.sh" which contains gpg --pinentry-mode loopback "$@".
Then I added this parameter to my sign-and-deploy-file goal: -Dgpg.executable="./gpghack.sh Now when GPG is called by Maven, it will use the shell-file which always adds the options I need.

Not pretty, but it works for now..

0
On

This works for me:

-DgpgArguments=--pinentry-mode,loopback