api / org.gradle.api.artifacts / Configuration / defaultDependencies

defaultDependencies

@Incubating abstract fun defaultDependencies(action: Action<in DependencySet>): Configuration

Execute the given action if the configuration has no defined dependencies when it first participates in dependency resolution. A Configuration will participate in dependency resolution when:

This method is useful for specifying default dependencies for a configuration:
 configurations { conf } configurations['conf'].defaultDependencies { dependencies -> dependencies.add(owner.project.dependencies.create("org.gradle:my-util:1.0")) } 
A Configuration is considered empty even if it extends another, non-empty Configuration. If multiple actions are supplied, each action will be executed until the set of dependencies is no longer empty. Remaining actions will be ignored.

Parameters

action - the action to execute when the configuration has no defined dependencies.

Return
this