getArtifacts

Returns the artifacts belonging to this dependency.

Initially, a dependency has no artifacts, so this can return an empty set. Typically, however, a producer project will add a single artifact to a module, which will be represented in this collection via a single element. But this is NOT always true. Modules can use custom classifiers or extensions to distinguish multiple artifacts that they contain.

In general, projects publishing using Gradle should favor supplying multiple artifacts by supplying multiple variants, each containing a different artifact, that are selectable through variant-aware dependency resolution. This mechanism where a module contains multiple artifacts is primarily intended to support dependencies on non-Gradle-published components.

See also