You can use a library from your Gemfury account as a dependency in a Gradle project. To do that, you can reference the artifact as a dependency in your project’s build.gradle.kts
:
dependencies {
implementation("com.example.group:artifact")
}
Next, you will add your Gemfury Gradle repository:
repositories {
maven {
url = uri("https://maven.fury.io/ACCOUNT/")
}
}
If the artifact is set to public, no other settings are needed. If the artifact is set to private, you will need to expand the above entry with this authentication configuration:
repositories {
maven {
url = uri("https://maven.fury.io/ACCOUNT/")
authentication {
create<BasicAuthentication>("basic")
}
credentials {
username = System.getenv("FURY_PULL_USER")
password = System.getenv("FURY_PULL_TOKEN")
}
}
}
Once you have this configuration in place, start your build:
$ FURY_PULL_USER=user FURY_PULL_TOKEN=token ./gradlew build
Updating dependencies
If you have updated your library, and you want your project to download the latest version, you can tell Gradle to check for updates to its dependencies.
$ ./gradlew build --refresh-dependencies
Equivalent Groovy configuration can be implemented into build.gradle
.