Maven -- is there a command to download the parent poms of all dependency jars?
Asked Answered
L

3

5

I know we can download the dependency jars... but can we download the parent poms of all dependency jars?

For example Project A brings in library B as dependency, but library B has parent pom C.xml.

I want to find a command that downloads all pom.xml in Bs and C.xml.

ideally if C.xml has another parent pom D.xml, I want to download that too.

Leaky answered 25/11, 2014 at 1:9 Comment(0)
P
3

Maven dependency plugin with add parent POMs option.

mvn dependency:copy-dependencies -Dmdep.addParentPoms=true -Dmdep.copyPom=true

If that doesn't work because of Maven using an older version of the dependency plugin (you need 2.8 or later for the addParentPoms option), use the latest version explicitly:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.9:copy-dependencies -Dmdep.addParentPoms=true -Dmdep.copyPom=true

These commands download dependencies (including transitive dependencies), their POMs and all the parent POMs recursively.

Peccavi answered 25/11, 2014 at 5:58 Comment(1)
Is there any command which recursively downloads all the dependant jars including their parent jars from the project.Magellan
P
3

The answer by prunge shows you have to download them using dependency plugin. If you are just curious to see those poms, maven does download them to the local cached copy of the repo. Just go to .m2/repoistory and you will find them as -.pom. The file is name as .pom and is actually the pom.xml for that particular artifact

Proteose answered 25/11, 2014 at 6:55 Comment(0)
G
1

The simplest solution is to use

mvn org.apache.maven.plugins:maven-dependency-plugin:2.9:resolve

or more short:

mvn dependency:resolve

it will resolve all dependencies incl. the pom's etc. Afterwards you can build with this repository offlline. They will be downloaded into the local repository. If you like to have those artifacts incl. their poms into a particular directory than you have to use the suggestions made by @prunge.

Gullible answered 25/11, 2014 at 7:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.