api / org.gradle.api.artifacts / ArtifactView

ArtifactView

@Incubating interface ArtifactView : HasAttributes

A view over the artifacts resolved for this set of dependencies. By default, the view returns all files and artifacts, but this can be restricted by component identifier or by attributes.

Since
3.4

Types

ViewConfiguration

interface ViewConfiguration : HasConfigurableAttributes<ViewConfiguration>

Configuration for a defined artifact view.

Functions

getArtifacts

abstract fun getArtifacts(): ArtifactCollection

Returns the collection of artifacts matching the requested attributes that are sourced from Components matching the specified filter.

getFiles

abstract fun getFiles(): FileCollection

Returns the collection of artifact files matching the requested attributes that are sourced from Components matching the specified filter.

Inherited Functions

getAttributes

abstract fun getAttributes(): AttributeContainer

Returns the attributes

Inheritors

ResolvableDependencies

interface ResolvableDependencies : ArtifactView

A set of Dependency objects which can be resolved to a set of files. There are various methods on this type that you can use to get the result in different forms:

  • #getFiles() returns a FileCollection that provides the result as a set of java.io.File instances.
  • #getResolutionResult() returns a ResolutionResult that provides information about the dependency graph.
  • #getArtifacts() returns an ArtifactCollection that provides the files with additional metadata.

The dependencies are resolved once only, when the result is first requested. The result is reused and returned for subsequent calls. Once resolved, any mutation to the dependencies will result in an error.