Closed ddidier closed 3 years ago
I didn't see that the key was not found using cli arguments. Even this one is not working when I pass an absolute file path. I must do something wrong but I don't know what.
can you try configuration like:
<plugins>
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>0.3.1</version>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<keyId>9D08D506AB01D82A8E7090F0C0FF87F9EEC1EF5D</keyId>
<keyPass>test</keyPass>
<keyFile>~/.m2/sign-key.ascxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</keyFile>
</configuration>
</plugin>
</plugins>
run only sign:sing
without build package probably cause to not found artifact to sign - but configuration should be accessible by plugin
mvn clean install sign:sign
is working with:
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>0.3.1</version>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<keyId>9D08D506AB01D82A8E7090F0C0FF87F9EEC1EF5D</keyId>
<keyPass>test</keyPass>
<keyFile>/home/xxx/.m2/sign-key.asc</keyFile>
</configuration>
</plugin>
Note that keyFile
is /home/xxx/.m2/sign-key.asc
and not ~/.m2/sign-key.asc
which is not working. That makes sense since this is a Java program.
But SIGN_KEY=/home/xxx/.m2/sign-key.asc SIGN_KEY_ID=9D08D506AB01D82A8E7090F0C0FF87F9EEC1EF5D SIGN_KEY_PASS=test mvn clean install sign:sign
is not working with:
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>0.3.1</version>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
The environment variables are not taken into account:
[DEBUG] Configuring mojo org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign from plugin realm ClassRealm[plugin>org.simplify4u.plugins:sign-maven-plugin:0.3.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@443b7951]
[DEBUG] Configuring mojo 'org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign' with basic configurator -->
[DEBUG] (f) keyFile = /home/xxx/.m2/sign-key.asc
[DEBUG] (f) skip = false
[DEBUG] (f) skipNoKey = true
[DEBUG] -- end configuration --
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.922 s
[INFO] Finished at: 2021-09-24T10:02:14+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign (default-cli) on project ndd-maven-parent: Execution default-cli of goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign failed: Secret key not found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign (default-cli) on project ndd-maven-parent: Execution default-cli of goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign failed: Secret key not found
...
And mvn clean install sign:sign -Dsign.keyFile=/home/xxx/.m2/sign-key.asc -Dsign.keyId=9D08D506AB01D82A8E7090F0C0FF87F9EEC1EF5D -Dsign.keyPass=test
is not working either although the variables seem to be taken into account:
[DEBUG] Configuring mojo org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign from plugin realm ClassRealm[plugin>org.simplify4u.plugins:sign-maven-plugin:0.3.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@443b7951]
[DEBUG] Configuring mojo 'org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign' with basic configurator -->
[DEBUG] (f) keyFile = /home/xxx/.m2/sign-key.asc
[DEBUG] (f) keyId = 9D08D506AB01D82A8E7090F0C0FF87F9EEC1EF5D
[DEBUG] (f) keyPass = test
[DEBUG] (f) skip = false
[DEBUG] (f) skipNoKey = true
[DEBUG] -- end configuration --
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.900 s
[INFO] Finished at: 2021-09-24T10:06:04+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign (default-cli) on project ndd-maven-parent: Execution default-cli of goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign failed: Secret key not found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign (default-cli) on project ndd-maven-parent: Execution default-cli of goal org.simplify4u.plugins:sign-maven-plugin:0.3.1:sign failed: Secret key not found
...
I created a small test case: sign-tests.tar.gz
test1.sh
(pom only) is workingtest2.sh
(environment variables) doesn'ttest3.sh
(arguments) is also working although I cannot see the difference with my previous posttest2.sh
misunderstand configuration: SIGN_KEY
- environment variable must contain private key content.
https://www.simplify4u.org/sign-maven-plugin/sign-mojo.html#keyFile
so change test to:
export SIGN_KEY=`cat sign-key.asc`
and will be ok
we can improve documentation in this point - if you like please prepare proposition
test3.sh
configuration
tags was moved from execution
level to plugin level
and change command from
mvn sign:sing
to
mvn clen install sign:sing
callling
mvn clean install sign:sign
cause to run sign plugin execute twice, once during verify maven phase and one from direct invoke from command line
it is enough to run mvn clean instal
- sign plugin will bind to proper maven lifecycle phase
Thanks, that's now working!
The documentation says "Default value is: ${user.home}/.m2/sign-key.asc
" so I thought that SIGN_KEY
was a file too.
So maybe change:
_This value can be delivered by environment variable SIGNKEY. Environment variable must contain private key content.
to something like this:
_This value can be delivered by environment variable SIGN_KEY. Environment variable must contain private key content, not the file path. Example: export SIGN_KEY=$(cat mykey.asc)
_
I'm happy that is working. If you have another question/problem please create new issue.
Describe the bug
The documentation states that there is 3 ways to pass the required parameters:
But only the command line arguments is working.
As this is a really big issue, maybe I did something wrong.
To Reproduce
I followed the tutorial https://www.simplify4u.org/sign-maven-plugin/key-prepare.html to create and export a key.
Using:
Expected behavior
Environment variables and POM configuration should work.