DependencyLockPlugin

class DependencyLockPlugin @Inject constructor(dependencyHandler: DependencyHandler, project: Project) : Plugin<Project> (source)

A plugin that enables version locking for dependency declarations in a Gradle project. It enforces constraints based on a predefined "versions.lock" file, generates this file when needed, and integrates version locking into the project's dependency resolution process.

Key functionalities:

  • Registers configurations for managing all dependencies and for resolving classpath dependencies.

  • Configures a write task (writeVersionsLocks) to generate a "versions.lock" file, capturing the resolved versions of dependencies.

  • Applies constraints defined in the "versions.lock" file to the lockConstraints configuration.

  • Ensures the api configuration in Java platform projects extends the lockConstraints configuration when the plugin is applied.

  • Coordinates dependency locking across multiple projects in a build via the DependencySupplierService.

Constructors

Link copied to clipboard
@Inject
constructor(dependencyHandler: DependencyHandler, project: Project)

Functions

Link copied to clipboard
open override fun apply(target: Project)

Applies the dependency lock plugin to the given project.