public abstract class AbstractModuleDependency extends AbstractDependency implements ModuleDependency
ARCHIVES_CONFIGURATION, CLASSIFIER, DEFAULT_CONFIGURATION| Modifier | Constructor and Description |
|---|---|
protected |
AbstractModuleDependency(String configuration) |
| Modifier and Type | Method and Description |
|---|---|
AbstractModuleDependency |
addArtifact(DependencyArtifact artifact)
Adds an artifact to this dependency.
|
DependencyArtifact |
artifact(Closure configureClosure)
Adds an artifact to this dependency.
|
protected void |
copyTo(AbstractModuleDependency target) |
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.
|
protected boolean |
isCommonContentEquals(ModuleDependency dependencyRhs) |
protected boolean |
isKeyEquals(ModuleDependency dependencyRhs) |
boolean |
isTransitive()
Returns whether this dependency should be resolved including or excluding its transitive dependencies.
|
void |
setArtifacts(Set<DependencyArtifact> artifacts) |
ModuleDependency |
setTransitive(boolean transitive)
Sets whether this dependency should be resolved including or excluding its transitive dependencies.
|
copyTo, hashCode, resolveclone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcopycontentEquals, getGroup, getName, getVersionprotected AbstractModuleDependency(String configuration)
public boolean isTransitive()
ModuleDependencyisTransitive in interface ModuleDependencyModuleDependency.setTransitive(boolean)public ModuleDependency setTransitive(boolean transitive)
ModuleDependencysetTransitive in interface ModuleDependencytransitive - Whether transitive dependencies should be resolved.public String getConfiguration()
ModuleDependencyDependency.DEFAULT_CONFIGURATION. A dependency source
might have multiple configurations. Every configuration represents a different set of artifacts and dependencies
for this dependency module.getConfiguration in interface ModuleDependencypublic ModuleDependency exclude(Map<String,String> excludeProperties)
ModuleDependency
Excluding a particular transitive dependency does not guarantee that it does not show up
in the dependencies of a given configuration.
For example, some other dependency, which does not have any exclude rules,
might pull in exactly the same transitive dependency.
To guarantee that the transitive dependency is excluded from the entire configuration
please use per-configuration exclude rules: Configuration.getExcludeRules().
In fact, in majority of cases the actual intention of configuring per-dependency exclusions
is really excluding a dependency from the entire configuration (or classpath).
If your intention is to exclude a particular transitive dependency
because you don't like the version it pulls in to the configuration
then consider using forced versions' feature: ResolutionStrategy.force(Object...).
apply plugin: 'java' //so that I can declare 'compile' dependencies
dependencies {
compile('org.hibernate:hibernate:3.1') {
//excluding a particular transitive dependency:
exclude module: 'cglib' //by artifact name
exclude group: 'org.jmock' //by group
exclude group: 'org.unwanted', module: 'iAmBuggy' //by both name and group
}
}
exclude in interface ModuleDependencyexcludeProperties - the properties to define the exclude rule.public Set<ExcludeRule> getExcludeRules()
ModuleDependencygetExcludeRules in interface ModuleDependencyModuleDependency.exclude(java.util.Map)public Set<DependencyArtifact> getArtifacts()
ModuleDependencygetArtifacts in interface ModuleDependencyModuleDependency.addArtifact(DependencyArtifact)public void setArtifacts(Set<DependencyArtifact> artifacts)
public AbstractModuleDependency addArtifact(DependencyArtifact artifact)
ModuleDependencyAdds 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.
addArtifact in interface ModuleDependencypublic DependencyArtifact artifact(Closure configureClosure)
ModuleDependencyAdds 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.
artifact in interface ModuleDependencyprotected void copyTo(AbstractModuleDependency target)
protected boolean isKeyEquals(ModuleDependency dependencyRhs)
protected boolean isCommonContentEquals(ModuleDependency dependencyRhs)
Copyright © 2013. All rights reserved