Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 604
Daniel Freeman Avatar asked Mar 14 '18 08:03

Daniel Freeman


People also ask

What does -> mean in Gradle?

It means that dependency graph contains multiple dependencies with the same group and module but different versions for e.g. org.

What is dependsOn in Gradle?

dependsOn(jar) means that if you run assemble , then the jar task must be executed before. the task transitive dependencies, in which case we're not talking about tasks, but "publications". For example, when you need to compile project A , you need on classpath project B , which implies running some tasks of B .

What is testImplementation in Gradle?

Configuration inheritance and composition For example the testImplementation configuration extends the implementation configuration. The configuration hierarchy has a practical purpose: compiling tests requires the dependencies of the source code under test on top of the dependencies needed write the test class.

Where are Gradle tasks configured?

Locating tasks In general, tasks are available through the tasks collection. You should use of the methods that return a task provider – register() or named() – to make sure you do not break task configuration avoidance. Tasks of a specific type can also be accessed by using the tasks. withType() method.


2 Answers

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.

like image 31
JJD Avatar answered Sep 20 '22 14:09

JJD


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

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

like image 170
centic Avatar answered Sep 22 '22 14:09

centic