This Gradle plugin rejects dependencies (including transitives) whose version string includes a configurable list of patterns. It is intended to be used to block non-stable versions of dependencies from inadvertently being consumed by a project.
First, add the appropriate buildscript repository and dependency:
buildscript { repositories { mavenCentral() } dependencies { classpath "com.adtran:betablocker-plugin:1.+" } }
Then apply the plugin using either the old style:
apply plugin: "com.adtran.betablocker-plugin"
...or the new style:
plugins { id "com.adtran.betablocker-plugin" }
It's also available via plugins.gradle.org.
To configure the plugin, add a block like the following to your build.gradle
:
betablocker { enabled true whitelist = [] rejectedVersions = ["alpha", "beta", "m", "snap", "latest", "rc"] rejectedVersionPatterns = [".*-[a-f0-9]{7}"] }
These properties are described in the following table:
Property | Type | Default | Description |
---|---|---|---|
enabled |
Boolean | true |
Set to false to disable the plugin entirely |
whitelist |
List<String> | [] |
A list of strings which if present in the display name of an artifact will prevent the plugin from rejecting any versions |
rejectedVersions |
List<String> | ["alpha", "beta", "m",
"snap", "latest",
"rc"] |
A list of strings which if present in the version of an artifact will cause it to be rejected (case insensitive). |
rejectedVersionPatterns |
List<String> | [".*-[a-f0-9]{7}"] |
A list of regular expression patterns which will cause a dependency to be rejected on match (case insensitive / lower case). |
This project is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0). Copyright 2018, ADTRAN, Inc.
Issues and pull requests are welcome if you have bugs/suggestions/improvements!
CI is managed with Github actions. Artifacts are published to plugins.gradle.org and Maven Central. Publishing to Maven Central is done via OSSRH. After CI uploads the artifacts to OSSRH, a maintainer has to promote the build to Maven Central:
- Log in to the Nexus instance at https://s01.oss.sonatype.org/ as the
adtran-maven
user - Click on "Staging Repositories" in the left-hand pane
- Select the new repository (artifact)
- Click "Close" in the toolbar
- Once it's closed (hit "Refresh" if needed), click "Release"
- It should show up in Maven Central eventually
Official instructions here.