Gradle build configured signatory
Asked Answered
H

4

17

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?

Haar answered 14/3, 2018 at 8:39 Comment(0)
D
12

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.

Dogie answered 15/4, 2021 at 20:34 Comment(0)
O
4

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")
    }
    ....
Owing answered 1/12, 2021 at 9:36 Comment(0)
C
1

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://mcmap.net/q/623932/-gradle-signing-android-library-publications-cannot-perform-signing-task-because-it-has-no-configured-signatory

Cobb answered 23/7, 2021 at 23:10 Comment(0)
M
-4

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

./gradlew assemble -x signArchives

Moan answered 24/9, 2018 at 12:4 Comment(1)
-x signArchives means don't execute the signing. While this solves the error, it doesn't achieve what the OP asked (how do I configure a signatory).Munch

© 2022 - 2024 — McMap. All rights reserved.