Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 335
CuriousMind Avatar asked Nov 25 '14 01:11

CuriousMind


2 Answers

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

like image 103
Yogesh_D Avatar answered Sep 21 '22 16:09

Yogesh_D


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.

like image 26
prunge Avatar answered Sep 24 '22 16:09

prunge