A lightweight Java build tool that requires zero external dependencies. Built using pure Java 25 functionality.
- 🚀 Zero external dependencies
- ⚡ Fast compilation and packaging
- 🔍 Automatic main class detection
- 📦 Executable JAR generation
- 🎯 Simple and intuitive usage
- Java 21 or later
- Git (for cloning the repository)
# Clone the repository
git clone https://github.com/AdamBien/zb.git
cd zb
# Build with Maven
mvn clean package
# The executable JAR will be in target/zb.jar
# Copy it to your desired location
cp target/zb.jar ~/bin/zb.jar# Compile and package with defaults
java -jar zb.jar
# Custom source directory
java -jar zb.jar src/main/java
# Custom source and output directories
java -jar zb.jar src/main/java target/classes target/jar
# Full customization (source, classes, jar directory, jar filename)
java -jar zb.jar src/main/java target/classes target/jar myapp.jar| Parameter | Default Value |
|---|---|
| Source Directory | src/main/java, src or current directory |
| Classes Directory | <temp.dir> (temporary directory) |
| JAR Output Directory | zbo |
| JAR Filename | app.jar |
zb supports configuration through a .zb properties file in your project root. If not present, zb will automatically create one with default values on first run.
| Property | Description | Default Value |
|---|---|---|
sources.dir |
Source directory path | <discovered by zb> |
resources.dir |
Resources directory path | <discovered by zb> |
classes.dir |
Compiled classes output directory | <temp.dir> |
jar.dir |
JAR output directory | zbo/ |
jar.file.name |
Name of the generated JAR file | app.jar |
# .zb configuration file
sources.dir=src/main/java
resources.dir=src/main/resources
classes.dir=<temp.dir> # or specify a custom directory like target/classes
jar.dir=target/
jar.file.name=myapp.jarWhen sources.dir or resources.dir are set to <discovered by zb>, the tool will automatically:
- Search for source directories in common locations (
src/main/java,src, or current directory) - Locate resource directories relative to the source directory
When classes.dir is set to <temp.dir>, zb will:
- Create a unique temporary directory for compiled classes
- Display the temporary directory path during build
- Automatically clean up the directory after JAR creation
- This is the default behavior to avoid cluttering your project
- Source Discovery: Automatically finds all Java files in the source directory
- Main Class Detection: Identifies the main class for the executable JAR
- Compilation: Compiles all Java files to bytecode
- Packaging: Creates an executable JAR with proper manifest

