Gradle

Gradle build system for Java and JVM-based projects.


Using Gradle Locally

Ensure the Desktop App is installed, running, and configured for Gradle.

Connect Desktop App →

Simply use your standard commands - the Desktop App handles authentication automatically:

Upload:

./gradlew publish

Download:

./gradlew build

Alternatively: Manual Configuration

1. Generate an Access Token

Create an access token →

2. Configure

Option A: Project Configuration

Edit build.gradle:

repositories {
    maven {
        url "https://<your-fly-subdomain>.jfrog.io/artifactory/maven"
        credentials {
            username = "<your-fly-username>"
            password = "<your-fly-token>"
        }
    }
}

publishing {
    publications {
        maven(MavenPublication) {
            from components.java
        }
    }
    repositories {
        maven {
            url "https://<your-fly-subdomain>.jfrog.io/artifactory/maven"
            credentials {
                username = "<your-fly-username>"
                password = "<your-fly-token>"
            }
        }
    }
}

Option B: Global Configuration

For global configuration (applies to all Gradle projects), create an init script at ~/.gradle/init.d/artifactory.gradle:

allprojects {
    repositories {
        maven {
            url "https://<your-fly-subdomain>.jfrog.io/artifactory/maven"
            credentials {
                username = "<your-fly-username>"
                password = "<your-fly-token>"
            }
        }
    }
}

rootProject {
    publishing {
        repositories {
            maven {
                name = "Fly"
                url = "https://<your-fly-subdomain>.jfrog.io/artifactory/maven"
                credentials {
                    username = "<your-fly-username>"
                    password = "<your-fly-token>"
                }
            }
        }
    }
}

Note: This approach automatically applies to all Gradle projects without modifying individual build.gradle files.

3. Upload

./gradlew publish

4. Download

./gradlew build

Using Gradle in CI/CD

Gradle is fully supported in GitHub Actions workflows configured with JFrog Fly.

Learn how to configure GitHub Actions →


Alternative: Maven → | Back to Java →