gradle
8.6

# defaultDependencies

abstract fun defaultDependencies(action: Action<out Any>): Configuration(source)

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:

- The Configuration itself is resolved
- Another Configuration that extends this one is resolved
- Another Configuration that references this one as a project dependency is resolved

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"))
    }

Content copied to clipboard

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.

#### Return

this

#### Parameters

action

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