-
Notifications
You must be signed in to change notification settings - Fork 4
Consuming Dependencies
The plugin adds five dependency configurations that mirror the standard Gradle Java scopes. Each one resolves its JARs from GitHub releases instead of a Maven repository.
"OWNER:REPO:VERSION"
"OWNER:REPO:VERSION:CLASSIFIER"
| Segment | Description |
|---|---|
OWNER |
GitHub user or organisation that owns the repository |
REPO |
Repository name |
VERSION |
Release tag (e.g. 1.0.0, v1.0.0) |
CLASSIFIER |
(optional) Selects a specific artifact from a multi-JAR release |
The tag matching is flexible: declaring 1.0.0 will also try v1.0.0, and vice versa.
| Configuration | Maps to Gradle scope | Requires |
|---|---|---|
githubImplementation |
implementation |
java plugin |
githubApi |
api |
java-library plugin |
githubCompileOnly |
compileOnly |
java plugin |
githubCompileOnlyApi |
compileOnlyApi |
java-library plugin |
githubRuntimeOnly |
runtimeOnly |
java plugin |
githubApi and githubCompileOnlyApi are silently skipped if the java-library plugin is not applied.
dependencies {
// Default artifact (repo.jar)
githubImplementation "my-org:my-library:1.0.0"
// Specific classifier — downloads my-library-api.jar from the release
githubImplementation "my-org:my-library:1.0.0:api"
// Leaked to consumers of your library (requires java-library plugin)
githubApi "my-org:my-library:1.0.0"
// Compile classpath only — not included at runtime
githubCompileOnly "my-org:annotation-processor:1.0.0"
// Compile only, leaked to consumers (requires java-library plugin)
githubCompileOnlyApi "my-org:annotations:1.0.0"
// Runtime classpath only — not visible at compile time
githubRuntimeOnly "my-org:jdbc-driver:1.0.0"
}When no classifier is specified the plugin selects the best JAR from the release assets in this priority order:
-
repo.jar— exact name match -
repo-VERSION.jar— versioned name match -
repo-standalone.jar— standalone/fat JAR - First
.jarthat is not a-sources.jaror-javadoc.jar
If a downloaded JAR contains a META-INF/github-dependencies.json file (written by this plugin's generateGithubDependencyMetadata task), those transitive GitHub dependencies are resolved and downloaded automatically. Cycles are prevented by a resolved-set guard.
Downloaded JARs are cached in ~/.gradle/github/OWNER/REPO-VERSION[-CLASSIFIER].jar. Re-running the build does not re-download them.
Getting started
Using the plugin
Reference