Resolving Dependencies

This guide covers how to resolve JVM dependencies with Antlers.

Note: antlers resolve uses CLI arguments only; it does not read dependencies from antlers.toml yet.

Basic Resolution

Resolve a single artifact:

antlers resolve org.jetbrains.kotlin:kotlin-stdlib:2.0.0

Resolve multiple artifacts:

antlers resolve \
  com.google.guava:guava:33.0.0-jre \
  com.fasterxml.jackson.core:jackson-databind:2.17.0

Artifact Coordinates

Coordinates follow the Maven format: groupId:artifactId:version

Optional classifier and/or extension: groupId:artifactId:version:classifier groupId:artifactId:version@extension groupId:artifactId:version:classifier@extension

Examples:

  • org.jetbrains.kotlin:kotlin-stdlib:2.0.0 - Standard JAR
  • org.jetbrains.kotlin:kotlin-stdlib:2.0.0:sources - Sources JAR
  • org.jetbrains.kotlin:kotlin-stdlib:2.0.0@pom - POM file

Output Formats

Text (Default)

antlers resolve com.google.guava:guava:33.0.0-jre
✓ com.google.guava:guava:33.0.0-jre (15 artifacts)
# com.google.guava:guava:33.0.0-jre
  com.google.guava:guava:33.0.0-jre (abc...)
  com.google.guava:failureaccess:1.0.2 (def...)
  ...

Dependency Tree

antlers resolve com.google.guava:guava:33.0.0-jre --format tree
com.google.guava:guava:33.0.0-jre
├── com.google.guava:failureaccess:1.0.2
├── com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
├── com.google.code.findbugs:jsr305:3.0.2
├── org.checkerframework:checker-qual:3.42.0
├── com.google.errorprone:error_prone_annotations:2.23.0
└── com.google.j2objc:j2objc-annotations:2.8

JSON

antlers resolve com.google.guava:guava:33.0.0-jre --format json
[
  {
    "root": "com.google.guava:guava:33.0.0-jre",
    "artifacts": [
      {
        "coordinate": "com.google.guava:guava:33.0.0-jre",
        "sha256": "abc123...",
        "sha1": "def456...",
        "depth": 0
      }
    ]
  }
]

Buck2 Build File

antlers resolve com.google.guava:guava:33.0.0-jre --format buck
# Generated by antlers

remote_file(
    name = "guava_jar",
    out = "guava-33.0.0-jre.jar",
    sha256 = "abc123...",
    url = "mvn:com.google.guava:guava:jar:33.0.0-jre",
)

prebuilt_jar(
    name = "guava",
    binary_jar = ":guava_jar",
    visibility = ["PUBLIC"],
)

Using Additional Repositories

Preset Repositories

antlers resolve com.github.user:repo:v1.0.0 --preset jitpack

Multiple presets:

antlers resolve some:artifact:1.0.0 --preset jitpack --preset jenkins

Custom Repository URL

antlers resolve com.example:lib:1.0.0 --repo https://maven.example.com/releases/

Transitive Dependencies

By default, transitive dependencies are resolved. To get only direct dependencies:

antlers resolve com.google.guava:guava:33.0.0-jre --transitive false

Gradle Module Metadata

Antlers supports Gradle Module Metadata (.module files) which provide richer dependency information including:

  • Platform-specific variants
  • Feature variants
  • Capability conflicts

To disable GMM and use only POM files:

antlers resolve some:artifact:1.0.0 --pom-only

Saving Output

Write results to a file:

antlers resolve com.google.guava:guava:33.0.0-jre -f json -o deps.json

Conflict Resolution

When multiple versions of the same artifact are found, Antlers uses a conflict strategy:

  • highest-wins (CLI default) - Use the highest version
  • nearest-wins - Use the version nearest to the root
  • strict - Fail on conflicts

The CLI currently always uses highest-wins. To change this, use the Rust API:

#![allow(unused)]
fn main() {
use antlers::Antlers;

let antler = Antlers::with_defaults().nearest_wins();
}

For strict conflict handling, use the lower-level dendro::Resolver with the StrictFails strategy.

Next Steps