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 TypeMethodDescriptionReturns the list of requested artifacts for the dependencybooleanReturns true if the dependency has requested a special artifact (either classifier, type or extension)voidselectArtifact(String type, String extension, String classifier) Adds an artifact to substitute.voidselectArtifact(DependencyArtifactSelector selector) Adds an artifact to substitute.voidRemoves 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
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 callgetRequestedSelectors()and add them usingselectArtifact(DependencyArtifactSelector).- Parameters:
type- the type of the artifact being queriedextension- the extension, defaults to the typeclassifier- the classifier, defaults to null (no classifier)
-
selectArtifact
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 isselectArtifact(String, String, String)
-