Vladislav
Vladislav

Reputation: 119

Downloading dependencies from pom.xml with Aether

I need to download all dependencies from a given pom.xml in my java programm. In Aether examples I can see only examples of resolving and downloading artifacts by maven coordinates, so I have to parse pom.xml, resolve constants in <version> tag, handle exclusions and etc. by myself. Can Aether (or other tool) do it for me?

Upvotes: 1

Views: 319

Answers (1)

sschuberth
sschuberth

Reputation: 29867

Try using ShrinkWrap instead, which uses Aether itself underneath. Example:

Maven.resolver()
    .loadPomFromFile("/path/to/pom.xml")
    .importRuntimeDependencies()
    .resolve()
    .withTransitivity()
    .asFile();

Upvotes: 1

Related Questions