# ModuleDependency

interface ModuleDependency : Dependency, HasConfigurableAttributes<ModuleDependency> (source)

A `ModuleDependency` is a org.gradle.api.artifacts.Dependency on a component that exists outside of the current project.

Modules can supply multiple artifacts in addition to the implicit default artifact. Non-default artifacts available in a module can be selected by a consumer by specifying a classifier or extension when declaring a dependency on that module.

For examples on configuring exclude rules for modules please refer to exclude.

#### Since

0.7

#### Inheritors

ExternalDependency
ProjectDependency

## Properties

ARCHIVES_CONFIGURATION
Link copied to clipboard
val ARCHIVES_CONFIGURATION: String = "archives"
The archives configuration.
CLASSIFIER
Link copied to clipboard
val CLASSIFIER: String = "m:classifier"
The classifier.
DEFAULT_CONFIGURATION
Link copied to clipboard
val DEFAULT_CONFIGURATION: String = "default"
The default configuration.

## Functions

addArtifact
Link copied to clipboard
abstract fun addArtifact(artifact: DependencyArtifact): ModuleDependency
Adds an artifact to this dependency.
artifact
Link copied to clipboard
abstract fun artifact(@DelegatesTo(value = DependencyArtifact::class, strategy = 1) configureClosure: Closure): DependencyArtifact
abstract fun artifact(configureAction: Action<in DependencyArtifact>): DependencyArtifact
Adds an artifact to this dependency.
attributes
Link copied to clipboard
abstract fun attributes(configureAction: Action<in AttributeContainer>): ModuleDependency
Mutates the attributes of this dependency.
because
Link copied to clipboard
abstract fun because(@Nullable reason: @Nullable String)
Sets the reason why this dependency should be used.
capabilities
Link copied to clipboard
abstract fun capabilities(configureAction: Action<in ModuleDependencyCapabilitiesHandler>): ModuleDependency
Configures the requested capabilities of this dependency.
copy
Link copied to clipboard
abstract fun copy(): ModuleDependency
Creates and returns a new dependency with the property values of this one.
doNotEndorseStrictVersions
Link copied to clipboard
abstract fun doNotEndorseStrictVersions()
Resets the isEndorsingStrictVersions state of this dependency.
endorseStrictVersions
Link copied to clipboard
abstract fun endorseStrictVersions()
Endorse version constraints with getStrictVersion strict versions} from the target module.
exclude
Link copied to clipboard
abstract fun exclude(excludeProperties: Map<String, String>): ModuleDependency
Adds an exclude rule to exclude transitive dependencies of this dependency.
getArtifacts
Link copied to clipboard
abstract fun getArtifacts(): Set<DependencyArtifact>
Returns the artifacts belonging to this dependency.
getAttributes
Link copied to clipboard
abstract fun getAttributes(): AttributeContainer
Returns the attributes for this dependency.
getCapabilitySelectors
Link copied to clipboard
@Incubating
abstract fun getCapabilitySelectors(): Set<CapabilitySelector>
Returns the set of capabilities that are requested for this dependency
getExcludeRules
Link copied to clipboard
abstract fun getExcludeRules(): Set<ExcludeRule>
Returns the exclude rules for this dependency.
getGroup
Link copied to clipboard
@Nullable
abstract fun getGroup(): @Nullable String
Returns the group of this dependency.
getName
Link copied to clipboard
abstract fun getName(): String
Returns the name of this dependency.
getReason
Link copied to clipboard
@Nullable
abstract fun getReason(): @Nullable String
Returns a reason why this dependency should be used, in particular with regards to its version.
getRequestedCapabilities
Link copied to clipboard
abstract fun getRequestedCapabilities(): List<Capability>
Returns the explicitly requested capabilities for this dependency.
getTargetConfiguration
Link copied to clipboard
@Nullable
abstract fun getTargetConfiguration(): @Nullable String
Returns the requested target configuration of this dependency.
getVersion
Link copied to clipboard
@Nullable
abstract fun getVersion(): @Nullable String
Returns the version of this dependency.
isEndorsingStrictVersions
Link copied to clipboard
abstract fun isEndorsingStrictVersions(): Boolean
Are the getStrictVersion strict version} dependency constraints of the target module endorsed?
isTransitive
Link copied to clipboard
abstract fun isTransitive(): Boolean
Returns whether this dependency should be resolved including or excluding its transitive dependencies.
setTargetConfiguration
Link copied to clipboard
abstract fun setTargetConfiguration(@Nullable name: @Nullable String)
Sets the requested target configuration of this dependency.
setTransitive
Link copied to clipboard
abstract fun setTransitive(transitive: Boolean): ModuleDependency
Sets whether this dependency should be resolved including or excluding its transitive dependencies.