Home

Awesome

Gradle Versions Filter Plugin

GitHub tag (latest SemVer) License REUSE status Conventional Commits

A simple Gradle plugin, built on the Gradle Versions Plugin with sane no-configuration-defaults and customization options.

Why?

The Gradle Version Plugin (which we love) leaves it up to the user to configure and define what is a stable or an unstable version.

It might become tiresome to add an include or exclude policy to every project in a large codebase - so why not make a plugin out of it.

How?

The plugin sets a default on what should be seen as the latest release. It either does this by having an inclusive or an exclusive policy.

It can also be configured to only use SemVer-compatible releases.

Usage

Add the plugin to your build.gradle.kts (or build.gradle)

plugins {
   id("se.ascp.gradle.gradle-versions-filter") version "x.y.z"
}

Run

./gradlew dependencyUpdates

And - that should be good enough for most people. For further options, see the Gradle Versions Plugin project, they should all be compatible. Add an issue if not.

Configurable Options:

OptionDefaultDescription
inclusiveQualifiers"RELEASE","FINAL","GA"default inclusive mode qualifiers
exclusiveQualifiers"alpha","beta","rc","cr","m","preview","b"default exclusive mode qualifiers
strategyEXCLUSIVEdefault strategy mode - EXCLUSIVE, INCLUSIVE, OR
strictSemVerfalseonly show strict SemVer-versions
logfalseverbose debug messages

In other words, if you do not configure anything, exclude strategy would be used and versions containing "alpha","beta","rc","cr","m","preview","b" would not be considered.

Note: Option values are not case-sensitive

( And most of the options you can set in the original Versions plugin can also be set, as follows, if you really need to. They are forwarded.) But, if you need to start configuring a lot, maybe the original plugin is the way to go).

OptionDefaultDescription
gradleReleaseChannelrelease-candidateSee the Versions Plugin for description
reportfileNamereportSee the Versions Plugin for description
outputDirbuild/dependencyUpdatesSee the Versions Plugin for description
checkForGradleUpdatetrueSee the Versions Plugin for description
checkConstraintsfalseSee the Versions Plugin for description
checkBuildEnvironmentConstraintsfalseSee the Versions Plugin for description
outputFormatterplainSee the Versions Plugin for description

Example configuration

Configuration examples

Overriding defaults, this would show debug output and does NOT exclude "alpha" releases

In build.gradle.kts

versionsFilter {
    exclusiveQualifiers.addAll("beta","rc","cr","m","preview","b" )
    log.set(true)
}

Overriding defaults, this uses inclusive strategy, and does only consider "FINAL" releases

versionsFilter {
    strategy.set(Strategy.INCLUSIVE)
    inclusiveQualifiers.addAll("FINAL")
    checkForGradleUpdate.set(false)
    
}

Example output

Default Gradle Versions-Plugin output

Example of default Gradle versions output

Default Gradle Versions Filter-Plugin output for same project (notice it lists latest stable versions)

Example of this plugins output

Notes

This plugin should probably be deprecated at some point, if the options are given as a Pull Request (and accepted) to the Gradle Versions plugin.

License

This project is released under the

Apache License 2.0