JAR Assembly

Create and inspect Java archives with Elide

elide jar runs the JAR tool included with Elide. Put the JAR tool’s options after --.

Common operations

Create an archive from compiled classes:

elide jar -- --create --file app.jar -C out .

List its contents:

elide jar -- --list --file app.jar

Extract it into a directory:

elide jar -- --extract --file app.jar --dir extracted

Create an executable JAR:

elide jar -- --create --file app.jar --main-class com.example.Main -C out .

For the wrapped tool’s complete help:

elide jar -- -help

Compile and package Java

For a small Java program, elide javac --jar compiles and packages in one step. The Elide-specific options go before --:

elide javac --jar target/app.jar -- src/Main.java src/Util.java
elide javac --jar target/app.jar --manifest src/MANIFEST.MF -- src/Main.java

Project artifacts

Elide projects can declare a JAR artifact and build it with elide build:

amends "elide:project.pkl"
import "elide:Jvm.pkl" as Jvm

artifacts {
  ["app"] = new Jvm.Jar {
    sources { "main" }
    options {
      entrypoint = "com.example.Main"
    }
  }
}

The project model also supports source and Javadoc JARs. See the elide.pkl Reference for artifact fields rather than duplicating the schema here.