ArtifactSelectionDetails (Gradle API 8.12)
Description: declaration: package: org.gradle.api.artifacts, interface: ArtifactSelectionDetails

Package org.gradle.api.artifacts

# Interface ArtifactSelectionDetails

public interface ArtifactSelectionDetails
Details about artifact dependency substitution: this class gives access to the original dependency requested artifacts, if any, and gives the opportunity to replace the original requested artifacts with other artifacts. This can typically be used whenever you need to substitute a dependency with uses a classifier to a non-classified dependency, or the other way around.

Since:
  6.6

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<DependencyArtifactSelector>`
  `getRequestedSelectors()`
  Returns the list of requested artifacts for the dependency
  `boolean`
  `hasSelectors()`
  Returns true if the dependency has requested a special artifact (either classifier, type or extension)
  `void`
  `selectArtifact(String type, String extension, String classifier)`
  Adds an artifact to substitute.
  `void`
  `selectArtifact(DependencyArtifactSelector selector)`
  Adds an artifact to substitute.
  `void`
  `withoutArtifactSelectors()`
  Removes all artifact selectors, if any.

- ## Method Details

  - ### hasSelectors

    boolean hasSelectors()
    Returns true if the dependency has requested a special artifact (either classifier, type or extension)

  - ### getRequestedSelectors

    List<DependencyArtifactSelector> getRequestedSelectors()
    Returns the list of requested artifacts for the dependency

  - ### withoutArtifactSelectors

    void withoutArtifactSelectors()
    Removes all artifact selectors, if any.

  - ### selectArtifact

    void selectArtifact(String type, @Nullable String extension, @Nullable String classifier)
    Adds an artifact to substitute. The first time this method is called, the original artifacts are replaced with the artifact defined by this method call. If you wish to add artifacts to the original query, you need to call `getRequestedSelectors()` and add them using `selectArtifact(DependencyArtifactSelector)`.
    Parameters:
      `type` - the type of the artifact being queried
      `extension` - the extension, defaults to the type
      `classifier` - the classifier, defaults to null (no classifier)

  - ### selectArtifact

    void selectArtifact(DependencyArtifactSelector selector)
    Adds an artifact to substitute. This method is a convenience to re-register artifacts requested by the original dependency. In most cases, the appropriate method to call is `selectArtifact(String, String, String)`