Dependency management

Table of Contents

Introduction to Dependency Management
What is dependency management?
Dependency management in Gradle
How dependency resolution works
Declaring Dependencies
Declaring a dependency to a module
Declaring a file dependency
Declaring a project dependency
Resolving specific artifacts from a module dependency
Managing Dependency Configurations
What is a configuration?
Defining custom configurations
Inheriting dependencies from other configurations
Declaring Repositories
Declaring a publicly-available repository
Declaring a custom repository by URL
Declaring multiple repositories
Inspecting Dependencies
Listing dependencies in a project
Identifying which dependency version was selected and why
Justifying dependency declarations with custom reasons
Managing Transitive Dependencies
Managing versions of transitive dependencies with dependency constraints
Excluding transitive module dependencies
Enforcing a particular dependency version
Disabling resolution of transitive dependencies
Importing version recommendations from a Maven BOM
Dependency Locking
Enabling locking on configurations
Generating and updating dependency locks
Lock state location and format
Running a build with lock state present
Selectively updating lock state entries
Disabling dependency locking
Locking limitations
Nebula locking plugin
Working with Dependencies
Iterating over dependencies assigned to a configuration
Iterating over artifacts resolved for a module
Navigating the dependency graph
Accessing a module’s metadata file
Customizing Dependency Resolution Behavior
Using dependency resolve rules
Using dependency substitution rules
Using component metadata rules
Using component selection rules
Using module replacement rules
Specifying default dependencies for a configuration
Enabling Ivy dynamic resolve mode
Troubleshooting Dependency Resolution
Resolving version conflicts
Using dynamic versions and changing modules
Controlling dependency caching programmatically
Controlling dependency caching from the command line
Locking dependency versions
Versioning of file dependencies