IvyPublication

API Documentation:IvyPublication

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

An IvyPublication is the representation/configuration of how Gradle should publish something in Ivy format.

The “ivy-publish” plugin and the default publication

The “ivy-publish” plugin creates one IvyPublication named “ivy” in the project's publishing.publications container. This publication is configured to publish all of the project's visible configurations (i.e. Project.getConfigurations()).

The Ivy module identifying attributes of the publication are mapped to:

  • module - project.name
  • organisation - project.group
  • revision - project.version
  • status - project.status

The ability to add multiple publications and finely configure publications will be added in future Gradle versions.

Publishing the publication

The “ivy-publish” plugin will automatically create a PublishToIvyRepository task for each IvyPublication and IvyArtifactRepository combination in publishing.publications and publishing.repositories respectively.

Given the following…

apply plugin: 'ivy-publish'

publishing {
  repositories {
    ivy { url "http://my.org/repo1" }
    ivy {
      name "other"
      url "http://my.org/repo2"
    }
  }
}

The following tasks will be created automatically by the plugin:

  • publishIvyPublicationToIvyRepository - publishes to the first repository (repository default name is “ivy”) defined
  • publishIvyPublicationToOtherRepository - publishes to the second repository defined

These tasks are of type PublishToIvyRepository. Executing the task will publish the publication to the associated repository.

The “publish” task

The “publish” plugin (that the “ivy-publish” plugin implicitly applies) adds a lifecycle task named “publish”. All PublishToIvyRepository tasks added by this plugin automatically become dependencies of this lifecycle task, which means that often the most convenient way to publish your project is to just run the “publish” task.

Properties

PropertyDescription
descriptor
Incubating

The module descriptor that will be published.

Property details

IvyModuleDescriptor descriptor (read-only)

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

The module descriptor that will be published.

Script blocks

No script blocks

Methods

MethodDescription
descriptor(configure)
Incubating

Configures the descriptor that will be published.

Method details

void descriptor(Action<? super IvyModuleDescriptor> configure)

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

Configures the descriptor that will be published.

The descriptor XML can be modified by using the IvyModuleDescriptor.withXml() method.