Daniel Freeman
Daniel Freeman

Reputation: 383

Gradle build configured signatory

I'm looking at the webpush-java code. I run into a problem attempting to build the project using gradle. (I'm a gradle newbie).

:signArchives FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':signArchives'.
    Cannot perform signing task ':signArchives' because it has no configured signatory

I guess that I need to configure a signatory. How do I do that?

Upvotes: 17

Views: 10673

Answers (4)

centic
centic

Reputation: 15882

Another option that does not require a special command-line option is to add the following in your build.gradle.kts:

signing {
    setRequired {
        // signing is only required if the artifacts are to be published
        gradle.taskGraph.allTasks.any { it.equals( PublishToMavenRepository) }
    }
    ....

See e.g. https://github.com/Vampire/command-framework/blob/master/buildSrc/src/main/kotlin/net/kautler/publishing.gradle.kts#L157

Or Groovy (build.gradle):

signing {
    required {
        // signing is only required if the artifacts are to be published
        gradle.taskGraph.hasTask("publishToMavenRepository")
    }
    ....

Upvotes: 4

JJD
JJD

Reputation: 51864

Quoting the Signing plugin documentation you should be able to resolve the error when you provide the expected GPG variables in the gradle.properties file in your HOME directory:

# File location: ~/.gradle/gradle.properties - see https://docs.gradle.org/current/userguide/directory_layout.html
signing.keyId=24875D73
signing.password=secret
signing.secretKeyRingFile=/Users/me/.gnupg/secring.gpg

Gradle resp. the Signing plugin will automatically pick them up in the build process.

Upvotes: 12

Itoun
Itoun

Reputation: 3227

I got the same problem and it was because of several things:
I didn't distribute the gpg key to any server;
I was using inMemory to sign and I shouldn't

the link of the complete answer with build.gradle file and gradle.properties file: https://stackoverflow.com/a/68505768/7937498

Upvotes: 1

Harish Karthick
Harish Karthick

Reputation: 720

Found solution here https://github.com/jaegertracing/jaeger-client-java/issues/202 Use the below command.

./gradlew assemble -x signArchives

Upvotes: -4

Related Questions