build
Compile a script into the jbx cache without running it.
When to use it
- Precompile a script during CI so the later run path starts from a warm cache.
- Validate generated Java without executing side effects.
- Check that dependency directives and CLI dependency overrides resolve together.
Common workflows
jbx build scripts/Report.java
jbx build --deps org.slf4j:slf4j-api:2.0.17 tools/Probe.java
jbx build --java 25 Hello.java
Real-life examples
Preflight a generated script before running it
jbx build generated/Report.java
jbx check generated/Report.java --json
Use build when execution would be unsafe or noisy but compilation must be proven: generated code, release helpers, migration scripts, or examples copied into docs.
Agent loop
- Read dependencies and Java version with
jbx info directives <file>. - Compile the smallest target with
jbx build <file>. - If it fails, fix compile errors before trying
jbx run. - For warning detail, follow with
jbx check <file> --json.
Agent notes
build proves resolution and compilation, not behavior. It is the safe gate before run for scripts with network, file, or deployment side effects.
Verification checklist
- Exit code is zero for the exact source file or directory being gated.
- Dependency resolution output does not point at unexpected repositories.
- The next command (
run,test, orexport) uses the same file and Java version assumptions.
Arguments and flags
This section is copied from the CLI help for this release so the page explains the actual accepted arguments.
jbx build
Compile and store script in the cache without running it
Usage: jbx build [OPTIONS] <SCRIPT>
Arguments:
<SCRIPT> Java source file
Options:
--deps <DEPS>
Additional dependency coordinates, same shape as //DEPS
--repo <REPOS>
Additional repository, same shape as //REPOS
--source <SOURCES>
Additional source file, same shape as //SOURCES
--files <FILES>
Additional file/resource, same shape as //FILES
--class-path <CLASSPATH>
Additional classpath entries
--javac-option <JAVAC_OPTIONS>
Additional javac option
--runtime-option <RUNTIME_OPTIONS>
Additional java runtime option, same shape as //JAVA_OPTIONS
--java <JAVA_VERSION>
Override //JAVA requested version
--javaagent <JAVA_AGENTS>
Additional java agent, same shape as //JAVAAGENT
--main <MAIN_CLASS>
Override //MAIN / inferred class name
--cache-dir <CACHE_DIR>
Override cache directory
--trust
Trust this remote script content hash before building
-h, --help
Print help
Skill
Agents can fetch the matching versioned skill with:
jbx skill get jbx-build