Skip to content

A Plugin for Gradle that checks your project dependencies for consistency

License

Notifications You must be signed in to change notification settings

Bisnode/version-check

Repository files navigation

version-check

Plugin for Gradle to check update your project dependencies ...

It works quite similar to the Enforcer plugin for Maven.

Usage

The simplest way to apply the plugin to your Gradle build is to use the plugin mechanism:

plugins {
    id "com.bisnode.versioncheck" version "<version>"
}

Gradle tasks

The plugin comes with two tasks:

  • versionCheck - Run the version checks against the project. The build fails, if violations are found.

  • versionCheckReport - Create a report of the checks for all projects and configrations.

Rules

Check for identical versions:

Specify the set of modules that should have the same version

versionCheck {
    sameVersionGroups = [ "org.springframework", "org.springframework.boot", "com.fasterxml.jackson.*" ]
}

The groups are groups in the sense of Maven artifact group IDs. Wildcards ("*") and placeholders ("?") are supported.

Which dependencies?

There are two main modes, you can use only the declared dependencies or additionally the transitive dependencies:

  • declared - only first level dependencies are included
  • transitive - the declared and all transitive dependencies (default)

Configuration example:

versionCheck {
    dependencies = 'transitive'
}

Configurations

To further customize which dependencies are analyzed, you can specify configurations, for example to include the dependencies that are only needed for tests with the Java plugin:

versionCheck {
    configurations 'testRuntime'  // this is the default
}

Tip: If there are dependencies showing up you have no idea where they are coming from, use gradle dependencies to get an overview of all configurations and the dependencies contained in them. Use it to identifiy the configurations that you want to include.

Multi-project builds

If you have a multi-build project that you want to treat as one single project, you should apply the plugin only to the root project and configure the plugin to include dependencies from sub-projects as well:

versionCheck {
  includeSubProjects = true
}

License

The MIT license (see the LICENSE file)

About

A Plugin for Gradle that checks your project dependencies for consistency

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages