name: zb description: Build Java 25+ projects with zb (Zero Dependencies Builder). Use when compiling, building, packaging, or running Java projects that have no external dependencies. Triggers on "build with zb", "zb build", "compile and package", "create executable JAR", or when a .zb configuration file is present in the project. Not for projects requiring Maven/Gradle dependency management.
zb - Zero Dependencies Builder
Build single-module Java 25+ projects into executable JARs without Maven or Gradle.
How to Build
Step 1: Check for zb.sh script
Search for a zb.sh wrapper script in this order — stop at the first match:
zb.shin the project root- Glob for
**/zb.shwithin the project directory tree - Glob for
**/zb.shone level above the project (sibling projects) - Check
~/bin/zb.shor~/.local/bin/zb.sh
If zb.sh is found, skip to Step 3 (zb.sh) — the script handles jar location and execution internally.
If zb.sh is not found, continue to Step 2 to locate zb.jar manually.
Step 2: Find zb.jar (only if zb.sh not found)
Locate zb.jar in this order — stop at the first match:
zb.jarin the project root- Glob for
**/zb.jarwithin the project directory tree - Glob for
**/zb.jarone level above the project (sibling projects) - Check
~/bin/zb.jaror~/.local/bin/zb.jar
If neither zb.sh nor zb.jar is found, tell the user to download from github.com/AdamBien/zb.
Step 3: Find the build directory
zb must run from the directory containing the .zb config file (or where one should be generated). In multi-module repos, this is the module subdirectory, not the repo root.
- Glob for
.zbfiles in the project cdinto the directory containing the.zbfile before running zb- If no
.zbexists, run from the directory that containssrc/main/java
Step 4: Run the build
With zb.sh:
cd <build-directory> && <path-to-zb.sh>
With zb.jar (fallback):
cd <build-directory> && java -jar <path-to-zb.jar>
Step 5: Verify
Check exit code and output. A successful build prints the number of compiled files. Common errors:
- "Multiple main classes found" — you are in the wrong directory (likely the repo root instead of a module subdirectory)
- Compilation errors — fix the source and rebuild
Source Directory Convention
zb auto-detects sources in order:
src/main/java(Maven convention, preferred)src/- Current directory
.
Resources auto-detected from src/main/resources or current directory.
Entry Point Requirement
The project must have exactly one class with a void main( method (Java 25+ unnamed main).
Configuration (.zb)
Optional .zb properties file in the build directory (auto-generated on first run):
sources.dir=<discovered by zb>
resources.dir=<discovered by zb>
classes.dir=<temp.dir>
jar.dir=zbo/
jar.file.name=app.jar
<discovered by zb>— auto-detect directory<temp.dir>— use temporary directory, cleaned after build
CLI Arguments (Positional)
java -jar zb.jar [sources] [classes] [jar_dir] [jar_file]
Precedence: CLI args > .zb file > defaults.
Output
Default: zbo/app.jar — executable JAR with Main-Class manifest entry.
Run with:
java -jar zbo/app.jar
Constraints
- Java 25+ required
- No external dependency support (no Maven/Gradle dependency resolution)
- Single-module projects only
- Exactly one main class per project
After a Successful Build
If the project has a test/ directory containing *Test.java files, ask the user if they want to run tests with /zunit.