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(publications)
Incubating

Creates signing tasks that sign all publishable artifacts of the given publication collection.

sign(tasks)

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.

sign(publications)
Incubating

Creates signing tasks that sign all publishable artifacts of the given publications.

signPom(mavenDeployment)

Signs the POM artifact for the given Maven deployment.

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.

Note: This method is incubating and may change in a future version of Gradle.

Creates signing tasks that sign all publishable artifacts of the given publication collection.

The created tasks will be named "sign<publication name capitalized>Publication". That is, given a publication with the name "mavenJava" the created task will be named "signMavenJavaPublication". The signature artifacts for the created tasks are added to the publishable artifacts of the given publications.

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

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 artifacts for the created tasks are added to the SigningExtension.getConfiguration() for this settings object.

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.

List<Sign> sign(Publication... publications)

Note: This method is incubating and may change in a future version of Gradle.

Creates signing tasks that sign all publishable artifacts of the given publications.

The created tasks will be named "sign<publication name capitalized>Publication". That is, given a publication with the name "mavenJava" the created task will be named "signMavenJavaPublication". The signature artifacts for the created tasks are added to the publishable artifacts of the given publications.

Signature signPom(MavenDeployment mavenDeployment)

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.

Note: Signing the generated POM file generated by the Maven Publishing plugin is currently not supported. Future versions of Gradle might add this functionality.

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.

Note: Signing the generated POM file generated by the Maven Publishing plugin is currently not supported. Future versions of Gradle might add this functionality.