Giter Site home page Giter Site logo

Comments (8)

ddidier avatar ddidier commented on September 27, 2024

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.

from sign-maven-plugin.

slawekjaranowski avatar slawekjaranowski commented on September 27, 2024

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

from sign-maven-plugin.

slawekjaranowski avatar slawekjaranowski commented on September 27, 2024

https://maven.apache.org/guides/mini/guide-default-execution-ids.html

from sign-maven-plugin.

ddidier avatar ddidier commented on September 27, 2024

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
...

from sign-maven-plugin.

ddidier avatar ddidier commented on September 27, 2024

I created a small test case: sign-tests.tar.gz

  • test1.sh (pom only) is working
  • test2.sh (environment variables) doesn't
  • test3.sh (arguments) is also working although I cannot see the difference with my previous post

from sign-maven-plugin.

slawekjaranowski avatar slawekjaranowski commented on September 27, 2024

test2.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 

execution hints

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

from sign-maven-plugin.

ddidier avatar ddidier commented on September 27, 2024

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 SIGN_KEY. 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)

from sign-maven-plugin.

slawekjaranowski avatar slawekjaranowski commented on September 27, 2024

I'm happy that is working.
If you have another question/problem please create new issue.

from sign-maven-plugin.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.