Zum Inhalt springen

Diese Seite ist noch nicht übersetzt und wird auf Englisch angezeigt.

Elide for Java users

Switching from a JDK with Maven or Gradle to Elide: running Java source directly with JDK 25, what changes in builds and tests, benchmarks and trade-offs.

Auf dieser Seite

Elide bundles JDK 25 with a build tool, Maven dependency resolver, JUnit runner and formatter in one binary.

Run the same code

A source file with a main method compiles and runs directly:

elide run Main.java

elide java, elide javac, elide jar and elide javadoc run the JDK 25 tools without a JDK install. Their arguments go after --:

elide javac -- -d out Main.java
elide java -- -cp out Main
elide jar -- --create --file app.jar -C out .
elide java -- -version

The distribution’s bin/ holds java, javac, jar, javadoc and javap, so an existing build can use it as JAVA_HOME; see JVM Toolchain.

A project is an elide.pkl file, which also lists Maven dependencies:

amends "elide:project.pkl"

jvm { main = "com.example.Hello" }

dependencies {
  maven {
    packages { "com.google.guava:guava:33.4.8-jre" }
  }
}
elide init --plain --skip-defaults --template java   # new project
elide install                                        # resolve Maven dependencies
elide build                                          # compile and assemble
elide test                                           # run JUnit tests
elide run                                            # run jvm.main
elide format -- src                                  # Google Java Format

JUnit is on the test classpath without a declared dependency. See Java and Kotlin with Elide, Testing and the elide.pkl reference.

What changes

With a JDK, Maven or GradleWith Elide
Install a JDKNothing; JDK 25 is bundled.
javac -d out Main.javaelide javac -- -d out Main.java
java Main.javaelide run Main.java
pom.xml, build.gradleelide.pkl
Resolve dependencieselide install; elide install -p . reads a pom.xml.
mvn package, gradle buildelide build
mvn test, gradle testelide test
gradle run, mvn exec:javaelide run
Maven goals on an existing pom.xmlelide mvn -- package; see Native Maven.
Migrate ./gradlew or mvn buildselide adopt; see Adopt an Existing Project.
native-imageelide native-image -- -cp app.jar com.example.Main
google-java-formatelide format
IDE project importelide project export --format=intellij or --format=pom

Benchmarks

No benchmarks are published for JVM programs in 1.6.0. For ahead-of-time builds, see Native Image.

Strengths

  • One binary replaces the JDK, Maven resolver, JUnit launcher and Google Java Format.
  • elide.pkl declares dependencies, tests and artifacts without plugins.
  • Annotation processors run in elide build and elide javac from a processors bucket.

Weaknesses

  • No Gradle support: elide build does not read build.gradle or build.gradle.kts, and Gradle plugins have no equivalent.
  • elide install -p . does not merge POM parents or imported BOMs; versions inherited from a parent are dropped.
  • No jlink, jpackage or jshell command, and JavaFX is not included.
  • elide adopt is untested on multi-module and Android projects.
  • javac jtreg tests: 99.9% pass (1 fail, 2 errors); see the Compatibility Matrix.
  • JDK tool arguments go after --: elide javac -d out Main.java exits 2.

Next steps

War diese Seite hilfreich?