PublishingExtension

API Documentation:PublishingExtension

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

The configuration of how to “publish” the different components of a project.

This new publishing mechanism will eventually replace the current mechanism of upload tasks and configurations. At this time, it is an incubating feature and under development.

Properties

PropertyDescription
publications
Incubating

The publications of the project.

repositories
Incubating

The container of possible repositories to publish to.

Property details

PublicationContainer publications (read-only)

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

The publications of the project.

See PublishingExtension.publications() for more information.

RepositoryHandler repositories (read-only)

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

The container of possible repositories to publish to.

See PublishingExtension.repositories() for more information.

Script blocks

No script blocks

Methods

MethodDescription
publications(configure)
Incubating

Configures the publications of this project.

repositories(configure)
Incubating

Configures the container of possible repositories to publish to.

Method details

void publications(Action<? super PublicationContainer> configure)

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

Configures the publications of this project.

The publications container defines the outgoing publications of the project. That is, the consumable representations of things produced by building the project. An example of a publication would be an Ivy Module (i.e. ivy.xml and artifacts), or Maven Project (i.e. pom.xml and artifacts).

The ability to create different kinds of publications is provided by different plugins. The “publishing” plugin itself does not provide a way to create publications.

Please see IvyPublication for information on publishing in the Ivy format. At this time it is not possible to publish in the Maven format with this mechanism.

void repositories(Action<? super RepositoryHandler> configure)

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

Configures the container of possible repositories to publish to.

apply plugin: 'publishing'

publishing {
  repositories {
    // Create an ivy publication destination named “releases”
    ivy {
      name "releases"
      url "http://my.org/ivy-repos/releases"
    }
  }
}

The repositories block is backed by a RepositoryHandler, which is the same DSL as that that is used for declaring repositories to consume dependencies from. However, certain types of repositories that can be created by the repository handler are not valid for publishing, such as RepositoryHandler.mavenCentral().

At this time, only repositories created by the ivy() factory method have any effect. Please see IvyPublication for information on how this can be used for publishing to Ivy repositories.