| API Documentation: | IvyPublication |
|---|
Note: This class is incubating and may change in a future version of Gradle.
A IvyPublication is the representation/configuration of how Gradle should publish something in Ivy format, to an Ivy repository.
You directly add a named Ivy Publication the project's publishing.publications container by providing IvyPublication as the type.
publishing {
publications {
myPublicationName(IvyPublication)
}
}The Ivy module identifying attributes of the publication are mapped as follows:
module-project.nameorganisation-project.grouprevision-project.versionstatus-project.status
For certain common use cases, it's often sufficient to specify the component to publish, using (IvyPublication.from().
The published component is used to determine which artifacts to publish, and which configurations and dependencies should be listed in the generated ivy descriptor file.
You can add configurations to the generated ivy descriptor file, by supplying a Closure to the IvyPublication.configurations() method.
To add additional artifacts to the set published, use the IvyPublication.artifact() and IvyPublication.artifact() methods.
You can also completely replace the set of published artifacts using IvyPublication.setArtifacts().
Together, these methods give you full control over the artifacts to be published.
For any other tweaks to the publication, it is possible to modify the generated Ivy descriptor file prior to publication. This is done using
the IvyModuleDescriptor.withXml() method, normally via a Closure passed to the IvyPublication.descriptor() method.
apply plugin: "java"
apply plugin: "ivy-publish"
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing {
publications {
myPublication(IvyPublication) {
from components.java
artifact(sourceJar) {
type "source"
extension "src.jar"
conf "runtime"
}
descriptor.withXml {
asNode().info[0].appendNode("description", "custom-description")
}
}
}
}| Property | Description |
descriptor | Incubating The module descriptor that will be published. |
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.
| Method | Description |
descriptor(configure) | Incubating Configures the descriptor that will be published. |
void descriptor(Action<? super IvyModuleDescriptor> configure)
Action<? super IvyModuleDescriptor>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.