Build Systems
jbundle automatically detects your build system and runs the appropriate commands.
Supported Build Systems
Clojure (tools.build)
deps.edn
clojure -T:build uber
Leiningen
project.clj
lein uberjar
Maven
pom.xml
mvn package -DskipTests
Gradle
build.gradle(.kts)
gradle build -x test
Clojure (deps.edn)
Requirements
Your deps.edn must have a :build alias with tools.build:
{:deps {...}
:aliases
{:build
{:deps {io.github.clojure/tools.build {:mvn/version "0.10.5"}}
:ns-default build}}}And a build.clj with an uber function:
(ns build
(:require [clojure.tools.build.api :as b]))
(def lib 'com.example/my-app)
(def version "1.0.0")
(def class-dir "target/classes")
(def uber-file (format "target/%s-%s.jar" (name lib) version))
(defn uber [_]
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/compile-clj {:basis (b/create-basis {:project "deps.edn"})
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis (b/create-basis {:project "deps.edn"})
:main 'com.example.main}))What jbundle Does
Clojure (Leiningen)
Requirements
Your project.clj should specify a :main namespace:
What jbundle Does
Java (Maven)
Requirements
Configure the Maven Shade Plugin for uberjar creation:
What jbundle Does
Java (Gradle)
Requirements
Use the Shadow plugin for uberjar creation:
Or with Groovy DSL:
What jbundle Does
Custom Build Arguments
Pass extra flags to Gradle (or any build system) with --build-args:
Or in jbundle.toml:
Arguments are appended after jbundle's default flags (e.g., after -x test for Gradle).
Multi-Project Builds
For Gradle projects with multiple subprojects, jbundle auto-detects those with the application plugin. See Gradle Multi-Project for details.
Quick example:
From Pre-built JAR
Skip the build step entirely:
Useful when:
You have a custom build process
The JAR is built by CI
You're testing with an existing artifact
Detection Priority
If multiple build files exist, jbundle uses this priority:
deps.edn(Clojure tools.build)project.clj(Leiningen)pom.xml(Maven)build.gradleorbuild.gradle.kts(Gradle)
Troubleshooting
"No build system detected"
Ensure one of the supported build files is in the root of --input directory.
"JAR not found after build"
Check that your build produces an uberjar (not just a thin JAR). The JAR must include all dependencies.
"Main class not found"
Ensure your JAR's MANIFEST.MF specifies Main-Class.
Last updated
Was this helpful?