# eachDependency

abstract fun eachDependency(rule: Action<in DependencyResolveDetails>): ResolutionStrategy

Adds a dependency substitution rule that is triggered for every dependency (including transitive) when the configuration is being resolved. The action receives an instance of DependencyResolveDetails that can be used to find out what dependency is being resolved and to influence the resolution process. Example:

    configurations {
      compileClasspath.resolutionStrategy {
        eachDependency { DependencyResolveDetails details ->
          //specifying a fixed version for all libraries with 'org.gradle' group
          if (details.requested.group == 'org.gradle') {
            details.useVersion '1.4'
          }
        }
        eachDependency { details ->
          //multiple actions can be specified
          if (details.requested.name == 'groovy-all') {
             //changing the name:
             details.useTarget group: details.requested.group, name: 'groovy', version: details.requested.version
          }
        }
      }
    }

Content copied to clipboard
The rules are evaluated in order they are declared. Rules are evaluated after forced modules are applied (see force

#### Return

this

#### Since

1.4