api / org.gradle.api.publish.maven / MavenPublication / setArtifacts

setArtifacts

abstract fun setArtifacts(sources: MutableIterable<*>): Unit

Clears any previously added artifacts from #getArtifacts and creates artifacts from the specified sources. Each supplied source is interpreted as per #artifact(Object). For example, to exclude the dependencies declared by a component and instead use a custom set of artifacts:

 apply plugin: "java" apply plugin: "maven-publish" task sourceJar(type: Jar) { classifier "sources" } publishing { publications { maven(MavenPublication) { from components.java artifacts = ["my-custom-jar.jar", sourceJar] } } } 

Parameters

sources - The set of artifacts for this publication.