Gradle has built-in support to upload packages to Maven repositories using its publish plugin. Your Gemfury account is fully compatible with this method.
Configure Gradle
To configure Gradle, add a new maven
type repository entry in the repositories
section (part of publishing
configuration) in the build.gradle.kts
of your project with your Repository URL.
The resulting build.gradle.kts
should include this:
plugins {
id("maven-publish")
}
publishing {
repositories {
maven {
name = "furyMaven"
url = uri("https://maven.fury.io/ACCOUNT/")
credentials {
username = System.getenv("FURY_PUSH_USER")
password = System.getenv("FURY_PUSH_TOKEN")
}
}
}
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
}
}
}
The publications
configuration tells Gradle to build a maven type (e.g. MavenPublication
) package containing Java code. This is the instruction which produces the Jar file that Gradle will upload to your Gemfury account.
Deploy your package
After the configurations above, you can now use Gradle publish to upload your packages.
FURY_PUSH_USER=user FURY_PUSH_TOKEN=**** ./gradlew publish
Equivalent Groovy configuration can be implemented into build.gradle
.