| Crates.io | jbuild |
| lib.rs | jbuild |
| version | 0.1.5 |
| created_at | 2025-12-06 18:30:26.693331+00 |
| updated_at | 2026-01-08 16:04:12.066321+00 |
| description | High-performance Java build tool supporting Maven and Gradle |
| homepage | https://github.com/yingkitw/jbuild |
| repository | https://github.com/yingkitw/jbuild |
| max_upload_size | |
| id | 1970544 |
| size | 1,442,048 |
Cargo for Java - A modern, fast, and user-friendly build system for Java projects.
🎉 Major Milestone: Completed Domain-Driven Design (DDD) implementation with 285 tests passing! See DDD Implementation Complete for details.
Java developers face significant friction with existing build tools:
add dependency command, manual XML editing requiredEvery mvn compile or gradle build wastes seconds waiting for the JVM to start.
jbuild is a native Rust implementation that brings the Cargo experience to Java:
| Metric | jbuild | Maven | Gradle |
|---|---|---|---|
| Startup | ~10ms | ~500ms | ~1000ms |
| Memory | ~50MB | ~200MB | ~300MB |
| Add Dependency | jbuild add pkg |
Edit XML manually | Edit DSL manually |
| Create Project | jbuild new app |
mvn archetype:generate (interactive) |
gradle init |
add, remove, search, treepom.xml or build.gradle# Install (coming soon)
cargo install jbuild
# Create a new project
jbuild new my-app
cd my-app
# Build and run
jbuild build
jbuild run # Auto-detect and run main class
jbuild run --main-class com.example.App # Specify main class
jbuild run arg1 arg2 # Pass arguments to application
# Manage dependencies
jbuild search slf4j # Search Maven Central
jbuild add org.slf4j:slf4j-api:2.0.9
jbuild remove org.slf4j:slf4j-api
jbuild tree # Show dependency tree
jbuild info org.slf4j:slf4j-api # Show package details
jbuild outdated # Check for outdated dependencies
jbuild update # Update all dependencies
jbuild lint # Run Checkstyle checks jbuild test # Run tests
## Usage
### Project Management
```bash
jbuild new my-app # Create new Maven project
jbuild new my-app -b gradle # Create new Gradle project
jbuild new my-lib -t lib # Create library project
jbuild init # Initialize in existing directory
jbuild workspace new my-workspace # Create new workspace
cd my-workspace
jbuild new core -t lib # Create core library
jbuild new app # Create application
jbuild workspace add core # Add projects to workspace
jbuild workspace add app
jbuild workspace list # List workspace members
jbuild workspace build # Build all projects in dependency order
jbuild workspace build compile # Build with specific goals
jbuild build # Compile + test + package
jbuild compile # Compile only
jbuild check # Check code (compile without artifacts)
jbuild test # Run tests
jbuild run # Build and run main class
jbuild watch # Watch for changes and auto-rebuild
jbuild watch --test # Watch and run tests on change
jbuild # Uses pom.xml/build.gradle or jbuild.toml (auto-converts to pom)
jbuild clean # Clean build outputs
jbuild add group:artifact # Add dependency (auto-detects latest version)
jbuild add group:artifact:version # Add dependency with specific version
jbuild add group:artifact --dev # Add test dependency
jbuild remove group:artifact # Remove dependency
jbuild tree # Show dependency tree
jbuild tree # Shows transitive dependencies
jbuild search <query> # Search Maven Central
jbuild info group:artifact # Show package details and versions
jbuild outdated # Show outdated dependencies
jbuild update # Update all dependencies to latest
jbuild update group:artifact # Update specific dependency
jbuild info group:artifact # Show package details and versions
# Use jbuild.toml (auto-converted to pom.xml for build execution)
cat > jbuild.toml <<'EOF'
[package]
name = "my-app"
version = "0.1.0"
java = "17"
[dependencies]
"org.slf4j:slf4j-api" = "2.0.9"
[dev-dependencies]
"org.junit.jupiter:junit-jupiter" = "5.10.0"
EOF
jbuild build # will generate pom.xml from jbuild.toml if no pom/build.gradle present
# jbuild.lock is auto-created from jbuild.toml for reproducible builds
# jbuild-workspace.toml - Workspace configuration
members = [
"core",
"api",
"app"
]
default_members = [
"core",
"app"
]
[resolver]
version_resolution = "Highest" # Highest, Lowest, Fail
conflict_resolution = "Highest" # Highest, Lowest, Fail
[package]
name = "my-workspace"
version = "1.0.0"
description = "Multi-project Java workspace"
jbuild lint # Run Checkstyle (9 checks)
jbuild lint -c checkstyle.xml # Use custom config
jbuild lint src/main/java # Check specific directory
| Feature | jbuild | Maven | Gradle |
|---|---|---|---|
| Language | Rust | Java | Groovy/Kotlin (JVM) |
| Startup Time | ~10ms | ~500ms | ~1000ms |
| Memory Usage | ~50MB | ~200MB+ | ~300MB+ |
| Build File | pom.xml / build.gradle | pom.xml | build.gradle(.kts) |
| Add Dependency | jbuild add |
Manual XML edit | Manual DSL edit |
| Search Packages | jbuild search |
❌ | ❌ |
| Remove Dependency | jbuild remove |
Manual XML edit | Manual DSL edit |
| Dep Tree | jbuild tree |
mvn dependency:tree |
gradle dependencies |
| Package Info | jbuild info |
❌ | ❌ |
| Check Outdated | jbuild outdated |
❌ | ❌ |
| Update Dependencies | jbuild update |
Manual edit | Manual edit |
| Linting | jbuild lint |
Plugin required | Plugin required |
| Project Creation | jbuild new |
mvn archetype:generate |
gradle init |
| Multi-module | ✅ Both systems | ✅ Reactor | ✅ Composite builds |
| Incremental Builds | ✅ Built-in | ✅ Plugin-based | ✅ Native |
The project is organized as a single crate with all modules under src/:
This is an ongoing project. Both Maven and Gradle support are implemented with shared infrastructure.
Key Features Implemented:
jbuild lint command with 9 checks)See TODO.md for the current list of remaining work items and MIGRATION.md for migration details.
The examples/ directory contains sample projects demonstrating jbuild capabilities:
examples/
├── simple-java-project/ # Single-module Maven project
│ ├── pom.xml
│ └── src/main/java/...
└── multi-module-maven/ # Multi-module Maven project
├── pom.xml # Parent POM
├── core/ # Core utilities module
├── api/ # API interfaces module
└── app/ # Application module
Sample Maven POM (examples/simple-java-project/pom.xml):
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>simple-java-project</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
examples/
├── simple-gradle-project/ # Single-module Gradle project
│ ├── build.gradle
│ └── src/main/java/...
└── multi-module-gradle/ # Multi-module Gradle project
├── settings.gradle # Project settings
├── build.gradle # Root build script
├── core/ # Core utilities module
├── api/ # API interfaces module
└── app/ # Application module
Sample Gradle build script (examples/simple-gradle-project/build.gradle):
plugins {
id 'java'
}
group = 'com.example'
version = '1.0.0'
sourceCompatibility = '11'
targetCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'junit:junit:4.13.2'
}
Sample settings.gradle (examples/multi-module-gradle/settings.gradle):
rootProject.name = 'multi-module-gradle'
include ':core'
include ':api'
include ':app'
# Build without JNI (uses external Maven process for plugins)
cargo build --release
# Build with JNI support (enables direct Java class loading)
cargo build --release --features jni
# Modern Cargo-like commands (auto-detects build system)
jbuild build # Compile the project
jbuild run # Build and run main class
jbuild test # Run tests
jbuild clean # Clean build outputs
jbuild lint # Check code style (Checkstyle)
# Dependency management
jbuild add org.slf4j:slf4j-api # Add dependency (latest version)
jbuild add org.slf4j:slf4j-api:2.0.9 # Add specific version
jbuild remove org.slf4j:slf4j-api # Remove dependency
jbuild tree # Show dependency tree
jbuild outdated # Show outdated dependencies
# Project creation
jbuild new my-app # Create new app project
jbuild new my-lib --template lib # Create new library project
jbuild init # Initialize in existing directory
# Legacy mode (explicit build file)
jbuild --file pom.xml compile
jbuild --file build.gradle build
# Generate shell completions
jbuild completions bash > /etc/bash_completion.d/jbuild
jbuild completions zsh > ~/.zsh/completions/_jbuild
jbuild completions fish > ~/.config/fish/completions/jbuild.fish
| Maven Goal | Gradle Task | Description |
|---|---|---|
compile |
compileJava |
Compile Java sources |
test-compile |
compileTestJava |
Compile test sources |
test |
test |
Run tests |
package |
jar |
Create JAR file |
clean |
clean |
Clean build outputs |
install |
- | Install to local repository |
| - | build |
Full build (compile + test + jar) |
jbuild lintThe lint command runs Checkstyle checks on Java source files:
# Check all Java files in src/main/java and src/test/java
jbuild lint
# Check specific files or directories
jbuild lint src/main/java
jbuild lint src/main/java/com/example/App.java
# Use custom Checkstyle configuration
jbuild lint -c checkstyle.xml
Available Checks:
The project includes comprehensive unit tests and integration tests:
# Run all tests
cargo test
# Run only unit tests
cargo test --lib
# Run integration tests
cargo test --test example_project
# Run with output
cargo test -- --nocapture
src/ modules with #[test] attributestests/ directorysrc/testing_utils.rs provides mock implementations for testingThe codebase provides several testing utilities in testing_utils:
MockArtifactRepository: In-memory artifact repository for testingMockDependencyResolver: Mock dependency resolver for controlled testingTestProjectBuilder: Fluent builder for creating test projectsExample usage:
use jbuild::{MockArtifactRepository, ArtifactRepository};
#[test]
fn test_artifact_resolution() {
let repo = MockArtifactRepository::new();
repo.add_artifact("com.example", "lib", "1.0.0", "/path/to/lib.jar".to_string());
assert!(repo.exists("com.example", "lib", "1.0.0"));
}
jbuild follows Domain-Driven Design (DDD) principles with clean architecture:
┌─────────────────────────────────────┐
│ Presentation Layer (CLI) │
└─────────────────────────────────────┘
↓
┌─────────────────────────────────────┐
│ Application Layer ✅ │
│ - BuildOrchestrationService │
│ - ProjectInitializationService │
│ - DependencyManagementService │
└─────────────────────────────────────┘
↓
┌─────────────────────────────────────┐
│ Domain Layer ✅ │
│ - Aggregates (MavenProject, etc) │
│ - Domain Services (5 services) │
│ - Value Objects (15+ objects) │
└─────────────────────────────────────┘
↓
┌─────────────────────────────────────┐
│ Infrastructure Layer ✅ │
│ - LocalRepository │
│ - RemoteRepository │
└─────────────────────────────────────┘
Completed Phases (1-6):
Test Coverage: 285 tests passing (100% pass rate)
Contributions are welcome! Please feel free to submit a Pull Request.
The codebase follows Domain-Driven Design principles. See DDD Migration Guide for contributing guidelines.
Licensed under the Apache License, Version 2.0.