SBOMs for Java, Kotlin and Spring Boot
Maven and Gradle have no built-in SBOM command, so sbombox generate uses a universal tool: cdxgen if installed, else syft. For the most accurate release SBOM, use the CycloneDX build plugin and upload its output.
At a glance
| Build tool | Built-in SBOM command | What sbombox generate runs | Lockfile to commit |
|---|---|---|---|
| Maven | No (CycloneDX Maven plugin) | cdxgen, then syft | None; pin versions in pom.xml |
| Gradle (Groovy or Kotlin DSL) | No (CycloneDX Gradle plugin) | cdxgen, then syft | gradle.lockfile if you use dependency locking |
| Spring Boot 3.3+ | Packages a CycloneDX SBOM when the plugin is applied | cdxgen, then syft | As for Maven or Gradle |
SBOMBox detects pom.xml, build.gradle and build.gradle.kts.
Generate with SBOMBox
Install cdxgen with the CLI. It needs Node.js 24+ and runs Maven or Gradle to resolve the full dependency tree, so it is slower than syft but more complete for Java.
curl -fsSL https://sbombox.com/install.sh | SBOMBOX_GENERATORS=syft,cdxgen sh
sbombox generate -o sbom.json
sbombox score sbom.jsonWithout cdxgen, SBOMBox uses syft. syft reads declared dependencies and jar files, and can miss transitive dependencies that only the build tool resolves.
To pin the choice, set SBOMBOX_GENERATOR to one or more generator names, comma-separated. SBOMBox tries them in that order and skips any that are not installed. An unknown name fails with the list of valid names.
SBOMBOX_GENERATOR=cdxgen sbombox generate -o sbom.jsonUse the build tool's plugin
Maven. Run the CycloneDX Maven plugin from the project root. Test scope is excluded by default. It writes target/bom.json and target/bom.xml.
mvn org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBomTo build it on every mvn package, bind the makeAggregateBom goal to the package phase in pom.xml.
Gradle. Apply the plugin in the root project. The cyclonedxBom task writes an aggregate SBOM to build/reports/cyclonedx/bom.json; cyclonedxDirectBom writes one per project. Version 3.6.1 was current on 16 November 2026.
plugins {
id("org.cyclonedx.bom") version "3.6.1"
}Exclude test configurations so test libraries stay out of the release SBOM:
tasks.cyclonedxDirectBom {
skipConfigs = listOf("(?i).*test.*")
}./gradlew cyclonedxBomThen score and upload:
# See what lowers the score
sbombox score target/bom.json --format detailed
# Check a ruleset, e.g. EU Cyber Resilience Act readiness
sbombox compliance target/bom.json -p cra-readiness
# Upload it to the active project, labelled with the release
sbombox push target/bom.json --version v1.4.0For Gradle, use build/reports/cyclonedx/bom.json in place of target/bom.json.
Spring Boot
Spring Boot 3.3 and later can package a CycloneDX SBOM in the application and serve it from the Actuator sbom endpoint. With spring-boot-starter-parent, the CycloneDX Maven plugin is pre-configured: declare it in pom.xml to turn it on. For Gradle, apply the org.cyclonedx.bom plugin as above.
<build>
<plugins>
<plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
</plugin>
</plugins>
</build>The SBOM is then available at /actuator/sbom/application. Like every Actuator endpoint except health, it is not exposed over HTTP by default. If you expose it with management.endpoints.web.exposure.include=health,sbom, put it behind authentication: it lists every library and version you run.
Monorepos and multi-module builds
- Maven:
makeAggregateBomat the parent produces one SBOM for all modules. RunmakeBomin a module for that module alone. - Gradle:
cyclonedxBomcombines the per-project SBOMs;cyclonedxDirectBomgives one per subproject. - Upload one SBOM per deployable service, each to its own SBOMBox project with
sbombox push FILE --project ID. See Unify SBOMs.
Known gaps and how SBOMBox handles them
- No native generator in SBOMBox for Java. It uses cdxgen, then syft. Install cdxgen for Java projects.
- Maven has no lockfile, so the resolved tree depends on the repositories and version ranges at build time. Pin versions and generate the SBOM in the same build that produces the release.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
No SBOM generator found for ecosystems [...]. Install one with: curl -fsSL https://sbombox.com/install.sh | sh | Neither cdxgen nor syft is installed | Run curl -fsSL https://sbombox.com/install.sh | SBOMBOX_GENERATORS=syft,cdxgen sh |
| Few components, no transitive dependencies | syft ran without a resolved build | Install cdxgen, or use the Maven or Gradle plugin |
| JUnit or Mockito in the SBOM | Test configurations included | Maven excludes test scope by default; in Gradle set skipConfigs |
404 from /actuator/sbom | Endpoint not exposed, or no SBOM packaged | Apply the CycloneDX plugin and add sbom to the exposure list |
In CI, run the same commands. See GitHub Actions, GitLab CI, Jenkins, Azure Pipelines, Bitbucket Pipelines or CircleCI, or use the GitHub Action.