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
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
Dependency Substitution Rules
Specifying default dependencies for a configuration
Enabling Ivy dynamic resolve mode
Component metadata rules
Component Selection Rules
Module replacement rules
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