abstract fun artifact(source: Any): IvyArtifact
Creates a custom IvyArtifact to be included in the publication. The artifact
method can take a variety of input:
org.gradle.api.Project#file(Object)
method. Name, extension and classifier values are interpolated from the file name. apply plugin: "ivy-publish" task sourceJar(type: Jar) { classifier "source" } task genDocs { doLast { // Generate 'my-docs-file.htm' } } publishing { publications { ivy(IvyPublication) { artifact sourceJar // Publish the output of the sourceJar task artifact 'my-file-name.jar' // Publish a file created outside of the build artifact source: 'my-docs-file.htm', classifier: 'docs', extension: 'html', builtBy: genDocs // Publish a file generated by the 'genDocs' task } } }
source
- The source of the artifact content.
abstract fun artifact(source: Any, config: Action<in IvyArtifact>): IvyArtifact
Creates an IvyArtifact to be included in the publication, which is configured by the associated action. The first parameter is used to create a custom artifact and add it to the publication, as per #artifact(Object)
. The created IvyArtifact is then configured using the supplied action. This method also accepts the configure action as a closure argument, by type coercion.
apply plugin: "ivy-publish" task sourceJar(type: Jar) { classifier "source" } task genDocs { doLast { // Generate 'my-docs-file.htm' } } publishing { publications { ivy(IvyPublication) { artifact(sourceJar) { // These values will be used instead of the values from the task. The task values will not be updated. classifier "src" extension "zip" conf "runtime->default" } artifact("my-docs-file.htm") { type "documentation" extension "html" builtBy genDocs } } } }
source
- The source of the artifact.
config
- An action to configure the values of the constructed IvyArtifact.