The dev.elide.settings and dev.elide plugins make Gradle’s JavaCompile tasks run elide javac, and add
formatting and dependency-export tasks. Gradle keeps dependency resolution, tests and packaging. This page covers
plugin release 1.2.0.
Requirements
| Version | |
|---|---|
| Gradle | 7.6.4 or later |
| JDK running Gradle | 17 or later |
| Plugins | 1.2.0, from Maven Central |
| Elide | 1.5.1+20260903 or later |
Release 1.2.0 is tested with Gradle 7.6.4, 8.14.5 and 9.7.1 on JDK 17, Gradle 8.14.5 on JDK 24 and Gradle 9.7.1 on JDK 26.
Install
The plugins are published to Maven Central. Add it to the plugin repositories in settings.gradle.kts, apply the
settings plugin and select the Elide runtime for the whole build:
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.elide.settings") version "1.2.0"
}
elide {
runtime {
mode = dev.elide.gradle.ElideRuntimeMode.MANAGED
version = "1.6.3"
}
}
The settings plugin also adds https://maven.elide.dev to the settings repositories, for the dev.elide and
dev.elide.gradle groups only.
Each project that should compile with Elide applies dev.elide, with no version. Projects that do not apply it are
untouched:
// build.gradle.kts
plugins {
id("dev.elide")
java
}
elide {
compiler = true
}
On Gradle 7.6, configure the settings extension with configure<dev.elide.gradle.ElideSettingsExtension> { runtime { … } }.
Runtime selection
mode |
Uses |
|---|---|
AUTO (default) |
runtime.executable, then elide on PATH at version or newer, then managed |
PATH |
runtime.executable, then elide on PATH at version or newer; never downloads |
MANAGED |
Downloads and verifies version once, then reuses it offline |
The PATH check runs elide --version and compares the semantic version, ignoring build metadata. Under AUTO an
older elide is skipped with a log line; under PATH the build fails and names both versions.
runtime.executable is a project setting and is never version-checked:
// build.gradle.kts
elide {
runtime {
mode = dev.elide.gradle.ElideRuntimeMode.PATH
executable = layout.projectDirectory.file("tools/elide")
}
}
MANAGED downloads elide.<os>-<arch>.tgz (.zip on Windows) and its .sha256 from the
Elide releases. A release version maps to its v tag (1.6.3 to
v1.6.3); a nightly version (1.6.3+20261107) is its own tag. Assets exist for Linux amd64 and arm64, macOS arm64 and
Windows amd64. The runtime is extracted to <GRADLE_USER_HOME>/caches/dev.elide/runtimes/<version>/<platform>/ and
shared by every build on the machine.
Applying the plugin downloads and runs nothing; the runtime is probed or prepared when a task needs it. To build offline, prepare the managed runtime once while connected:
./gradlew prepareElideRuntime
./gradlew --offline build
Configuration
Settings elide { runtime { } } block, shared by every project that applies dev.elide:
| Property | Default | Effect |
|---|---|---|
mode |
AUTO |
Runtime selection mode |
version |
1.5.1+20260903 |
Managed version and minimum PATH version |
versionFrom(catalog, alias) |
Reads version from a version catalog |
version and versionFrom are exclusive. With versionFrom("libs", "elide"), declare elide under [versions] in
gradle/libs.versions.toml.
Project elide { } block:
| Property | Default | Effect |
|---|---|---|
compiler |
true |
Compile JavaCompile tasks with elide javac |
persistentCompiler |
false |
Keep up to four elide javac workers warm for the rest of the build |
dependencyMode |
LEGACY |
GRADLE: Gradle owns resolution; install must stay off |
install |
false |
Run elide install in the project directory before compiling |
maven |
true |
With install, add .dev/dependencies/m2 as a Maven repository |
manifest |
elide.pkl |
Manifest tracked as an elideInstall input |
devRoot |
root .dev |
Directory holding dependencies/m2 |
runtime { } |
settings | Per-project mode, version and executable |
persistentCompiler, dependencyMode and manifest are Gradle properties; .set(…) works on every Gradle version:
// build.gradle.kts
elide {
dependencyMode.set(dev.elide.gradle.ElideDependencyMode.GRADLE)
persistentCompiler.set(true)
}
The older names enableJavaCompiler, enableInstall, enableMavenIntegration, elideBin, runtimeMode,
runtimeVersion and resolveElideFromPath still work but are deprecated.
Gradle properties override the block for a run, in both directions. Any value other than true reads as false:
| Property | Effect |
|---|---|
elide. |
Compile with stock javac, without elideInstall or prepareElideRuntime |
elide. |
Force elide install on; fails with dependencyMode GRADLE |
./gradlew build -Pelide.builder.javac.enable=false
Tasks
| Task | Does |
|---|---|
prepareElideRuntime |
Downloads and verifies the managed runtime; skipped for other runtimes |
elideInstall |
Runs elide install; skipped unless install = true |
elideJavaFormat |
Writes javaformat copies of .java files to build/ |
elideKtfmt |
Writes ktfmt copies of .kt and .kts files to build/ |
elideCheckFormat |
Fails when files under src/ differ from those copies; changes nothing |
elideFormat |
Applies those copies to src/ |
elideExportDependencies |
Runs elideExport<SourceSet>Dependencies for every source set |
elideExport<SourceSet>Dependencies |
Writes build/ |
Each dependency report line holds a coordinate, file name and SHA-256, from the source set’s runtime classpath. The
formatting tasks are opt-in and never run during compilation. elideJavaFormat and elideKtfmt accept style
options through arguments; see Formatting for the formatters themselves:
// build.gradle.kts
tasks.named<dev.elide.gradle.ElideFormatTask>("elideKtfmt") {
arguments.set(listOf("--kotlinlang-style"))
}
tasks.named("check") { dependsOn("elideCheckFormat") }
elideKtfmt accepts --meta-style, --google-style, --kotlinlang-style and --do-not-remove-unused-imports.
elideJavaFormat accepts --aosp, --fix-imports-only, --skip-sorting-imports, --skip-removing-unused-imports,
--skip-reflowing-long-strings and --skip-javadoc-formatting. Any other argument fails the task.
compileJava and compileTestJava keep their task types, so incremental compilation and the build cache work as
usual. Cache keys include the Elide executable, the managed runtime version, the platform and the exact JDK build
running Gradle.
Example
settings.gradle.kts
build.gradle.kts
src/main/java/com/example/HelloWorld.java
// build.gradle.kts
plugins {
id("dev.elide")
java
application
}
application {
mainClass = "com.example.HelloWorld"
}
repositories {
mavenCentral()
}
elide {
compiler = true
}
dependencies {
implementation("com.google.guava:guava:33.4.8-jre")
}
// src/main/java/com/example/HelloWorld.java
package com.example;
import com.google.common.util.concurrent.SettableFuture;
public class HelloWorld {
public static void main(String[] args) throws Exception {
var greeting = SettableFuture.<String>create();
greeting.set("Hello, World!");
System.out.println(greeting.get());
}
}
With the settings.gradle.kts from Install:
./gradlew build
./gradlew -q run
Hello, World!
The first build downloads Elide in prepareElideRuntime; later builds, including --offline ones, reuse it.
OpenRewrite and dependency queries
For projects with an elide.pkl, see OpenRewrite and
Dependency code index. The Gradle plugin does not add rewrite or code-index tasks;
elideExportDependencies exports coordinates and checksums, but its output is not an input to elide index.
See the project setup boundary before using these commands
alongside Gradle.
Limits
- Only Java compilation goes through Elide. Kotlin (
compileKotlin) uses the Kotlin Gradle plugin’s compiler. persistentCompilerdoes not supportforkOptions.jvmArgs. Workers end with the build; each request times out after five minutes.MANAGEDis unavailable on Intel macOS; usePATHorruntime.executablethere. Windows arm64 and other operating systems fail in every mode.- A managed runtime takes about 2.5 GB per version and platform. Extraction uses the JVM temporary directory; set
TMPDIRif it is small. - With
install = true, run./gradlew elideInstallbeforebuildwhen dependencies exist only in.dev/dependencies/m2: Gradle can resolve them before any task runs. - The formatting tasks cover sources under
src/only. - Build cache entries are shared only between Gradle daemons on the same JDK build.