Inspired by https://github.com/spring-gradle-plugins/gradle-enterprise-conventions-plugin, this plugin configures public Gradle projects to use the public Gradle Enterprise instance at ge.gradle.org.
Requires Gradle 7.6+. The plugin is configuration-cache compatible when used the Gradle Enterprise plugin 3.11.3+.
When applied as a settings plugin alongside the Gradle Enterprise Plugin, this plugin does the following:
- If the build cache is enabled (via
--build-cacheororg.gradle.caching=true, see the doc):- Enable the local cache.
- Enable ge.gradle.org as remote cache and anonymous read access, enjoy faster build!
- There're three build cache node available on the earth:
eu(the default)/us/au, you can use-DcacheNode=us/-DcacheNode=auto use other ones.
- There're three build cache node available on the earth:
- Enable pushing to remote cache on CI if required credentials are provided.
- By default, build scans are published to
ge.gradle.org. If you would like to publish to your own GE server, add-Dgradle.enterprise.url=https://ge.mycompany.com/. If you would like to publish to public build scan server (scan.gradle.com), add-DagreePublicBuildScanTermOfService=yesto your build.- For CI build (
CIenvironment variable exists):- Add
CIbuild scan tag. - Add build scan link and build scan custom value
gitCommitIdto the build (by auto detecting environment variables):- Travis:
TRAVIS_BUILD_ID/TRAVIS_BUILD_WEB_URL - Jenkins:
BUILD_ID/BUILD_URL - GitHub Actions:
${System.getenv("GITHUB_RUN_ID")} ${System.getenv("GITHUB_RUN_NUMBER")}/https://github.com/gradle/gradle/runs/${System.getenv("GITHUB_RUN_ID")} - TeamCity:
BUILD_ID/BUILD_URL
- Travis:
- Upload build scans in the foreground.
- Add
- For local build:
- Add
LOCALbuild scan tag. - Add build scan custom value
gitCommitIdby runninggit rev-parse --verify HEAD. - If running in IDEA:
- Add
IDEAbuild scan tag. - Add build scan custom value
ideaVersionto IDEA version.
- Add
- Upload build scans in the background.
- Add
- For CI and local builds:
- Add build scan custom value
gitBranchNameby runninggit rev-parse --abbrev-ref HEAD. - If the build directory is dirty:
- Add build scan tag
dirty - Add build scan custom value
gitStatuswith the output ofgit status --porcelain
- Add build scan tag
- Add build scan custom value
- For CI build (
The plugin is published to gradle plugin portal.
This is done by configuring a plugin management repository in settings.gradle, as shown in the following example:
plugins {
// …
id "com.gradle.enterprise" version "<<version>>"
id "io.github.gradle.gradle-enterprise-conventions-plugin" version "<<version>>"
// …
}
To enable build scan publishing, authenticate with Gradle Enterprise doc, then add a gradle.enterprise.url system property to your build.
./gradlew myBuildTask -Dgradle.enterprise.url=https://ge.mycompany.com/
To enable build cache pushing, the access key associated with the build needs to have build cache write permission.
export GRADLE_CACHE_REMOTE_URL=https://ge.mycompany.com/
./gradlew myBuildTask
./gradlew myBuildTask -Dgradle.cache.remote.server=https://ge.mycompany.com/
To enable build scan publishing, you need to correctly authenticate as documented here.
Feel free to fork this repository, customize the plugin, and make a contribution!
You can install the plugin to local maven repository via:
./gradlew publishPluginMavenPublicationToMavenLocal
Then use the plugin under development via:
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath("com.gradle.enterprise:gradle-enterprise-conventions-plugin:${thePluginVersion}")
}
}
plugins {
id("com.gradle.enterprise").version("3.16.2")
}
apply(plugin= "io.github.gradle.gradle-enterprise-conventions-plugin")