Skip to content

Search

Search the docs, blog, and marketplace.

maven

Last updated October 25, 2026View source (v0.30.0)

This page explains how Bomly builds a dependency graph for maven projects: the detector chain it runs, what that chain needs, and what it can report.

PropertyValue
Package managermaven
Ecosystemmaven
Detector chainmaven-detector, syft-detector
Evidence patternspom.xml, *pom.xml
Ignored directoriestarget
Multi-module resolutionYes
Install-first supportYes
Remediation hintsdirect-bump1, transitive-override2
Commands the chain may runmvn. The Syft fallback is built in; the lite build runs an external syft from PATH instead.

How maven resolves

maven-detector is a build-tool primary chain. Maven projects do not normally ship lockfiles, so there is no lockfile fallback. Bomly runs Maven's own resolver to produce the graph.

StepCommandWorking dir
Resolve graphmvn dependency:tree -DoutputType=tgf (uses the ./mvnw wrapper if present)every directory containing a pom.xml

Bomly parses the Trivial Graph Format output into a full transitive graph and keeps the Maven scopes (compile, runtime, test, provided, system) as edge attributes.

mvn dependency:tree may download artifacts during a plain scan. If an artifact, parent POM, imported BOM, or plugin is not in ~/.m2/repository, Maven fetches it from Maven Central or the repositories your settings.xml declares. That is Maven's behavior, not Bomly's, and the same downloads happen when you run mvn compile. See Network and privacy for the shared rule. To keep the scan offline, run mvn dependency:go-offline once to warm ~/.m2/repository.

Prerequisites

  • mvn, or the ./mvnw wrapper, on PATH. The detector cannot resolve without running Maven.
  • A valid pom.xml at every module root. Multi-module reactors are supported, and each pom.xml is its own subproject.
  • For private repositories, configure ~/.m2/settings.xml as usual. Bomly does not authenticate to repositories itself.

Examples

Fix a direct vulnerability

Raise the version in pom.xml and re-scan:

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.17.1</version>
</dependency>

Pin a transitive vulnerability

Use <dependencyManagement> to override the version a transitive dependency resolves to, then re-scan:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.17.1</version>
    </dependency>
  </dependencies>
</dependencyManagement>

--install-first

With --install-first, Bomly runs mvn dependency:resolve (through ./mvnw if present) before resolving the graph. That downloads artifacts from Maven Central, or the repositories your settings.xml declares, into ~/.m2/repository, so the following mvn dependency:tree runs offline. Use it on a clean checkout when the local repository is cold:

bomly scan --install-first

To append flags to that command, repeat --install-arg. This requires --detectors maven-detector:

# Activate a Maven profile and point at a settings file
bomly scan --install-first --detectors maven-detector \
  --install-arg -Pproduction \
  --install-arg --settings --install-arg ./ci-settings.xml

Reachability (experimental)

With --analyze, the jvmreach analyzer walks .java, .kt, .kts, .scala, and .groovy files under the project root and reads their import statements. It maps package-name prefixes to Maven coordinates with a curated longest-prefix map. For multi-module reactors it reads parent <modules> declarations and follows imports between sibling modules first. Unreachable is a triage signal, not proof of safety; see Reachability.

If a missing prefix causes a direct import to be reported as unreachable, open a pull request against the jvmreach analyzer repository to add the mapping.

Limitations

  • System-scoped dependencies (<scope>system</scope>) are recorded but not classified by ecosystem. Bomly cannot follow <systemPath> to a Maven coordinate.
  • Classifier-only differences collapse to one graph node. Two artifacts that differ only by classifier (for example linux-x86_64 and macos-aarch64) get the same reachability result.
  • Annotation processors that generate code at build time are invisible to source-based reachability.
  • Maven is required. There is no offline-only path for Maven graph resolution.

Footnotes

  1. Update a package declared directly in the project. ↩

  2. Pin an indirect package with the package manager's override feature. ↩