PublishingExtension (Gradle API 8.11.1)

Package org.gradle.api.publish

## Interface PublishingExtension

-     public interface PublishingExtension

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

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `NAME` | The name of this extension when installed by the `PublishingPlugin` ("publishing").

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `PublicationContainer` | `getPublications()` | The publications of the project.
    `RepositoryHandler` | `getRepositories()` | The container of possible repositories to publish to.
    `void` | `publications​(Action<? super PublicationContainer> configure)` | Configures the publications of this project.
    `void` | `repositories​(Action<? super RepositoryHandler> configure)` | Configures the container of possible repositories to publish to.

- - ### Field Detail

    - #### NAME

          static final java.lang.String NAME

      The name of this extension when installed by the `PublishingPlugin` ("publishing").
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getRepositories

          RepositoryHandler getRepositories()

      The container of possible repositories to publish to.

      See `repositories(org.gradle.api.Action)` for more information.

      Returns:
        The container of possible repositories to publish to.

    - #### repositories

          void repositories​(Action<? super RepositoryHandler> configure)

      Configures the container of possible repositories to publish to.

           plugins {
               id '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.

      Parameters:
        `configure` - The action to configure the container of repositories with.

    - #### getPublications

          PublicationContainer getPublications()

      The publications of the project.

      See `publications(org.gradle.api.Action)` for more information.

      Returns:
        The publications of this project.

    - #### publications

          void publications​(Action<? super PublicationContainer> configure)

      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).

      Actual publication implementations and the ability to create them are provided by different plugins. The “publishing” plugin itself does not provide any publication types. For example, given that the 'maven-publish' plugin provides a `MavenPublication` type, you can create a publication like:

           plugins {
               id 'maven-publish'
           }

           publishing {
             publications {
               myPublicationName(MavenPublication) {
                 // Configure the publication here
               }
             }
           }

      Please see `IvyPublication` and `MavenPublication` for more information on publishing in these specific formats.

      Parameters:
        `configure` - The action or closure to configure the publications with.