api / org.gradle.plugins.signing / SigningExtension / sign

sign

open fun sign(vararg tasks: Task): MutableList<Sign>

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 org.gradle.api.tasks.bundling.AbstractArchiveTask, an InvalidUserDataException will be thrown.

The signature artifact for the created task is added to the .

Parameters

tasks - The tasks whose archives are to be signed

Return
the created tasks.

open fun sign(vararg configurations: Configuration): MutableList<Sign>

Creates signing tasks that sign all artifacts 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 configuration for this settings object.

Parameters

configurations - The configurations whose archives are to be signed

Return
the created tasks.

@Incubating open fun sign(vararg publications: Publication): MutableList<Sign>

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.

Parameters

publications - The publications whose artifacts are to be signed

Return
the created tasks.

Since
4.8

@Incubating open fun sign(publications: DomainObjectCollection<Publication>): MutableList<Sign>

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.

Parameters

publications - The collection of publications whose artifacts are to be signed

Return
the created tasks.

Since
4.8

open fun sign(vararg publishArtifacts: PublishArtifact): SignOperation

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.

Parameters

publishArtifacts - The publish artifacts to sign

Return
The executed SignOperation

open fun sign(vararg files: File): SignOperation

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.

Parameters

files - The files to sign.

Return
The executed SignOperation.

open fun sign(classifier: String, vararg files: File): SignOperation

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.

Parameters

classifier - The classifier to assign to the created signature artifacts.

files - The publish artifacts to sign.

Return
The executed SignOperation.

open fun sign(closure: Closure<Any>): SignOperation

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.

Parameters

closure - The configuration of the SignOperation.

Return
The executed SignOperation.