Groovy Documentation

org.gradle.api.publish.ivy
[Java] Interface IvyPublication

org.gradle.api.publish.ivy.IvyPublication
  org.gradle.api.Named
      org.gradle.api.publish.Publication
All Superinterfaces:
Named, Publication

@Incubating
@HasInternalProtocol
public interface IvyPublication
extends Publication

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:

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

Generating the ivy module descriptor

A GenerateIvyDescriptor task will be created for each IvyPublication in publishing.publications. Each GenerateIvyTask is automatically a dependency of the respective PublishToIvyRepository task, so this task is only required for generating the ivy.xml file without also publishing your module.
 apply plugin: 'ivy-publish'
 generateIvyModuleDescriptor {
     destination = file('generated-ivy.xml') // Override the default file that will contain the descriptor
 }
 
Since:
1.3


Method Summary
void descriptor(Action configure)

Configures the descriptor that will be published.

IvyModuleDescriptor getDescriptor()

The module descriptor that will be published.

 
Methods inherited from interface Named
getName
 

Method Detail

descriptor

public void descriptor(Action configure)
Configures the descriptor that will be published.

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

Parameters:
configure - The configuration action.


getDescriptor

public IvyModuleDescriptor getDescriptor()
The module descriptor that will be published.

Returns:
The module descriptor that will be published.


 

Gradle API 1.4-rc-1