org.gradle.api.artifacts
Interface ModuleDependency

All Superinterfaces:
Dependency
All Known Subinterfaces:
ClientModule, ExternalDependency, ExternalModuleDependency, ProjectDependency

public interface ModuleDependency
extends Dependency

A ModuleDependency is a Dependency on a module outside the current project.

A module dependency is an entity. Its key consists of the fields group, name, version, configuration.


Field Summary
 
Fields inherited from interface org.gradle.api.artifacts.Dependency
ARCHIVES_CONFIGURATION, CLASSIFIER, DEFAULT_CONFIGURATION
 
Method Summary
 ModuleDependency addArtifact(DependencyArtifact artifact)
          Adds an artifact to this dependency.
 DependencyArtifact artifact(Closure configureClosure)
          Adds an artifact to this dependency.
 ModuleDependency copy()
          Creates and returns a new dependency with the property values of this one.
 ModuleDependency exclude(Map<String,String> excludeProperties)
          Adds an exclude rule to exclude transitive dependencies of this dependency.
 Set<DependencyArtifact> getArtifacts()
          Returns the artifacts belonging to this dependency.
 String getConfiguration()
          Returns the configuration of this dependency module (not the configurations this dependency belongs too).
 Set<ExcludeRule> getExcludeRules()
          Returns the exclude rules for this dependency.
 boolean isTransitive()
          Returns whether this dependency should be resolved including or excluding its transitive dependencies.
 ModuleDependency setTransitive(boolean transitive)
          Sets whether this dependency should be resolved including or excluding its transitive dependencies.
 
Methods inherited from interface org.gradle.api.artifacts.Dependency
contentEquals, getGroup, getName, getVersion
 

Method Detail

exclude

ModuleDependency exclude(Map<String,String> excludeProperties)
Adds an exclude rule to exclude transitive dependencies of this dependency. You can also add exclude rules per-configuration. See Configuration.getExcludeRules().

Parameters:
excludeProperties - the properties to define the exclude rule.
Returns:
this

getExcludeRules

Set<ExcludeRule> getExcludeRules()
Returns the exclude rules for this dependency.

See Also:
exclude(java.util.Map)

getArtifacts

Set<DependencyArtifact> getArtifacts()
Returns the artifacts belonging to this dependency.

See Also:
addArtifact(DependencyArtifact)

addArtifact

ModuleDependency addArtifact(DependencyArtifact artifact)

Adds an artifact to this dependency.

If no artifact is added to a dependency, an implicit default artifact is used. This default artifact has the same name as the module and its type and extension is jar. If at least one artifact is explicitly added, the implicit default artifact won't be used any longer.

Returns:
this

artifact

DependencyArtifact artifact(Closure configureClosure)

Adds an artifact to this dependency. The given closure is passed a DependencyArtifact instance, which it can configure.

If no artifact is added to a dependency, an implicit default artifact is used. This default artifact has the same name as the module and its type and extension is jar. If at least one artifact is explicitly added, the implicit default artifact won't be used any longer.

Returns:
this

isTransitive

boolean isTransitive()
Returns whether this dependency should be resolved including or excluding its transitive dependencies.

See Also:
setTransitive(boolean)

setTransitive

ModuleDependency setTransitive(boolean transitive)
Sets whether this dependency should be resolved including or excluding its transitive dependencies. The artifacts belonging to this dependency might themselve have dependencies on other artifacts. The latter are called transitive dependencies.

Parameters:
transitive - Whether transitive dependencies should be resolved.
Returns:
this

getConfiguration

String getConfiguration()
Returns the configuration of this dependency module (not the configurations this dependency belongs too). Never returns null. The default value for the configuration is Dependency.DEFAULT_CONFIGURATION. A dependency source might have multiple configurations. Every configuration represents a different set of artifacts and dependencies for this dependency module.


copy

ModuleDependency copy()
Creates and returns a new dependency with the property values of this one.

Specified by:
copy in interface Dependency
Returns:
The copy. Never returns null.