# Signing artifacts

version 9.7.1

The Signing Plugin can be used to sign all artifacts and metadata files that make up a publication, including Maven POM files and Ivy module descriptors. In order to use it:

1. Apply the Signing Plugin

2. Configure the signatory credentials — follow the link to see how

3. Specify the publications you want signed

Here’s an example that configures the plugin to sign the `mavenJava` publication:

build.gradle.kts

    signing {
        sign(publishing.publications["mavenJava"])
    }

build.gradle

    signing {
        sign publishing.publications.mavenJava
    }

This will create a `Sign` task for each publication you specify and wire all `publishPubNamePublicationToRepoNameRepository` tasks to depend on it. Thus, publishing any publication will automatically create and publish the signatures for its artifacts and metadata, as you can see from this output:

## Example: Sign and publish a project

    $ ./gradlew publish

    > Task :compileJava
    > Task :processResources
    > Task :classes
    > Task :jar
    > Task :javadoc
    > Task :javadocJar
    > Task :sourcesJar
    > Task :generateMetadataFileForMavenJavaPublication
    > Task :generatePomFileForMavenJavaPublication
    > Task :signMavenJavaPublication
    > Task :publishMavenJavaPublicationToMavenRepository
    > Task :publish

    BUILD SUCCESSFUL in 0s
    10 actionable tasks: 10 executed