Dependency Checker Gradle Plugin

The Dependency Checker Gradle plugin lets you warn users if a specific configuration dependency is not the latest one available from the Maven central repository. The plugin eventually fails the build if the dependency age (the difference between the timestamp of the current version and the latest version) is above a predetermined threshold.

The plugin has been successfully tested with Gradle 4.10.2.

Usage

To use the plugin, include it in your build script:

buildscript {
    dependencies {
        classpath group: "com.liferay", name: "com.liferay.gradle.plugins.dependency.checker", version: "1.0.3"
    }

    repositories {
        maven {
            url "https://repository-cdn.liferay.com/nexus/content/groups/public"
        }
    }
}

apply plugin: "com.liferay.dependency.checker"

Project Extension

The Dependency Checker Gradle plugin exposes the following properties through the extension named dependencyChecker:

Property NameTypeDefault ValueDescription
ignoreFailuresbooleantrueWhether to print an error message instead of failing the build when the dependency check fails, either for a network error or because the dependency is out-of-date.

The same extension exposes the following methods:

MethodDescription
void maxAge(Map<?, ?> args)Declares the max age allowed for a dependency. The args map must contain the following entries:
  • configuration: the configuration name
  • group: the dependency group
  • name: the dependency name
  • maxAge: an instance of groovy.time.Duration that represents the maximum age allowed for the dependency
  • throwError: a boolean value representing whether to throw an error if the dependency is out-of-date

Additional Configuration

There are additional configurations that can help you use the Deployment Helper.

Project Properties

It is possible to set the default values of the ignoreFailures property via the project property dependencyCheckerIgnoreFailures:

-PdependencyCheckerIgnoreFailures=false
Was this article helpful?
0 out of 0 found this helpful