SigningExtension

API Documentation:SigningExtension

The global signing configuration for a project.

Properties

PropertyDescription
required

Whether or not this task should fail if no signatory or signature type are configured at generation time.

signatory

The signatory that will be used for signing when an explicit signatory has not been specified.

signatureType

The signature type that will be used for signing files when an explicit signature type has not been specified.

Methods

MethodDescription
sign(closure)

Creates a new SignOperation using the given closure to configure it before executing it.

sign(files)

Digitally signs the files, generating signature files alongside them.

sign(classifier, files)

Digitally signs the files, generating signature files alongside them.

sign(tasksToSign)

Creates signing tasks that depend on and sign the "archive" produced by the given tasks.

sign(configurations)

Creates signing tasks that sign Configuration.getAllArtifacts() of the given configurations.

sign(publishArtifacts)

Digitally signs the publish artifacts, generating signature files alongside them.

signPom(mavenDeployment, closure)

Signs the POM artifact for the given Maven deployment.

Script blocks

No script blocks

Property details

boolean required

Whether or not this task should fail if no signatory or signature type are configured at generation time.

Defaults to true.

Signatory signatory (read-only)

The signatory that will be used for signing when an explicit signatory has not been specified.

Delegates to the signatory provider's default signatory.

SignatureType signatureType (read-only)

The signature type that will be used for signing files when an explicit signature type has not been specified.

Delegates to the signature type provider's default type.

Method details

SignOperation sign(Closure closure)

Creates a new SignOperation using the given closure to configure it before executing it.

The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

If there is no configured default signatory available (and one is not explicitly specified in this operation's configuration), the sign operation will fail.

SignOperation sign(File... files)

Digitally signs the files, generating signature files alongside them.

The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

If there is no configured default signatory available, the sign operation will fail.

SignOperation sign(String classifier, File... files)

Digitally signs the files, generating signature files alongside them.

The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

If there is no configured default signatory available, the sign operation will fail.

List<Sign> sign(Task... tasksToSign)

Creates signing tasks that depend on and sign the "archive" produced by the given tasks.

The created tasks will be named "sign<input task name capitalized>". That is, given a task with the name "jar" the created task will be named "signJar".

If the task is not an AbstractArchiveTask, an InvalidUserDataException will be thrown.

The signature artifact for the created task is added to the SigningExtension.getConfiguration().

List<Sign> sign(Configuration... configurations)

Creates signing tasks that sign Configuration.getAllArtifacts() of the given configurations.

The created tasks will be named "sign<configuration name capitalized>". That is, given a configuration with the name "archives" the created task will be named "signArchives". The signature artifact for the created task is added to the SigningExtension.getConfiguration().

SignOperation sign(PublishArtifact... publishArtifacts)

Digitally signs the publish artifacts, generating signature files alongside them.

The project's default signatory and default signature type from the SigningExtension will be used to generate the signature. The returned SignOperation gives access to the created signature files.

If there is no configured default signatory available, the sign operation will fail.

Signature signPom(MavenDeployment mavenDeployment, Closure closure)

Signs the POM artifact for the given Maven deployment.

You can use this method to sign the generated POM when publishing to a Maven repository with the Maven plugin.

uploadArchives {
  repositories {
    mavenDeployer {
      beforeDeployment { MavenDeployment deployment ->
        signing.signPom(deployment)
      }
    }
  }
}

You can optionally provide a configuration closure to fine tune the SignOperation for the POM.

If SigningExtension.isRequired() is false and the signature cannot be generated (e.g. no configured signatory), this method will silently do nothing. That is, a signature for the POM file will not be uploaded.