MavenArtifactSet

A Collection of MavenArtifacts to be included in a MavenPublication. Being a DomainObjectSet, a MavenArtifactSet provides convenient methods for querying, filtering, and applying actions to the set of MavenArtifacts.

plugins {
    id 'maven-publish'
}

def publication = publishing.publications.create("name", MavenPublication)
def artifacts = publication.artifacts

artifacts.matching({
    it.classifier == "classy"
}).all({
    it.extension = "ext"
})

See also

Functions

Link copied to clipboard
abstract fun add(p: E): Boolean
Link copied to clipboard
abstract fun addAll(p: Collection<out E>): Boolean
Link copied to clipboard
abstract fun addAllLater(provider: Provider<out Iterable<T>>)
Link copied to clipboard
abstract fun addLater(provider: Provider<out T>)
Link copied to clipboard
abstract fun all(action: Action<in T>)
Link copied to clipboard
abstract fun artifact(source: Any): MavenArtifact
Creates and adds a MavenArtifact to the set.
abstract fun artifact(source: Any, config: Action<in MavenArtifact>): MavenArtifact
Creates and adds a MavenArtifact to the set, which is configured by the associated action.
Link copied to clipboard
abstract fun clear()
Link copied to clipboard
abstract fun configureEach(action: Action<in T>)
Link copied to clipboard
abstract fun contains(p: Any): Boolean
Link copied to clipboard
abstract fun containsAll(p: Collection<out Any>): Boolean
Link copied to clipboard
open fun <E> copyOf(coll: Collection<out E>): Set<E>
Link copied to clipboard
abstract fun equals(p: Any): Boolean
Link copied to clipboard
abstract fun findAll(spec: Closure): Collection<T>
abstract fun findAll(spec: Closure): Set<T>
Link copied to clipboard
open fun forEach(action: Consumer<in T>)
Link copied to clipboard
abstract fun hashCode(): Int
Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
abstract fun iterator(): Iterator<T>
abstract fun iterator(): Iterator<E>
Link copied to clipboard
abstract fun matching(spec: Spec<in T>): DomainObjectCollection<T>
abstract fun matching(spec: Spec<in T>): DomainObjectSet<T>
Link copied to clipboard
open fun <E> of(): Set<E>
Link copied to clipboard
open fun parallelStream(): Stream<E>
Link copied to clipboard
abstract fun remove(p: Any): Boolean
Link copied to clipboard
abstract fun removeAll(p: Collection<out Any>): Boolean
Link copied to clipboard
open fun removeIf(filter: Predicate<in E>): Boolean
Link copied to clipboard
abstract fun retainAll(p: Collection<out Any>): Boolean
Link copied to clipboard
abstract fun size(): Int
Link copied to clipboard
Link copied to clipboard
open fun stream(): Stream<E>
Link copied to clipboard
abstract fun toArray(): Array<Any>
abstract fun <T> toArray(p: Array<T>): Array<T>
Link copied to clipboard
abstract fun whenObjectAdded(action: Closure)
abstract fun whenObjectAdded(action: Action<in T>): Action<in T>
Link copied to clipboard
abstract fun whenObjectRemoved(action: Closure)
abstract fun whenObjectRemoved(action: Action<in T>): Action<in T>
Link copied to clipboard
abstract fun <S : T?> withType(type: Class<S>): DomainObjectCollection<S>
abstract fun <S : T?> withType(type: Class<S>): DomainObjectSet<S>
Link copied to clipboard

Returns a collection containing the objects in this collection of the given type. The returned collection is live, so that when matching objects are later added to this collection, they are also visible in the filtered collection.

inline fun <S : Any> DomainObjectCollection<in S>.withType(noinline configuration: S.() -> Unit): DomainObjectCollection<S>

Returns a collection containing the objects in this collection of the given type. Equivalent to calling withType(type).all(configureAction).

inline fun <S : T, T : Any> DomainObjectCollection<T>.withType(type: KClass<S>, configureAction: Action<in S>): DomainObjectCollection<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.DomainObjectCollection.withType.

inline fun <S : T, T : Any> DomainObjectSet<T>.withType(type: KClass<S>): DomainObjectSet<S>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.DomainObjectSet.withType.