Languages

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

Java build tools and how SBOMBox handles them
Build toolBuilt-in SBOM commandWhat sbombox generate runsLockfile to commit
MavenNo (CycloneDX Maven plugin)cdxgen, then syftNone; pin versions in pom.xml
Gradle (Groovy or Kotlin DSL)No (CycloneDX Gradle plugin)cdxgen, then syftgradle.lockfile if you use dependency locking
Spring Boot 3.3+Packages a CycloneDX SBOM when the plugin is appliedcdxgen, then syftAs 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.json

Without 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.json

Use 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:makeAggregateBom

To 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 cyclonedxBom

Then 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.0

For 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

Known gaps and how SBOMBox handles them

Troubleshooting

Common Java issues
SymptomCauseFix
No SBOM generator found for ecosystems [...]. Install one with: curl -fsSL https://sbombox.com/install.sh | shNeither cdxgen nor syft is installedRun curl -fsSL https://sbombox.com/install.sh | SBOMBOX_GENERATORS=syft,cdxgen sh
Few components, no transitive dependenciessyft ran without a resolved buildInstall cdxgen, or use the Maven or Gradle plugin
JUnit or Mockito in the SBOMTest configurations includedMaven excludes test scope by default; in Gradle set skipConfigs
404 from /actuator/sbomEndpoint not exposed, or no SBOM packagedApply 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.