Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a list of build targets *with dependencies* in Ant?

Tags:

ant

I found this question:

How can I get a list of build targets in Ant?

What I'd like to know: Is there a way to get a list of targets, together with their depends-on values? We have a large build.xml file and the way it's currently written the presence or absence of a description doesn't really tell me much as to whether a target is a main target or an "other" target.

Running ant 1.8.1, this is an initial bit of due diligence as I prepare to upgrade to Gradle so I need to figure out which targets are truly the "high level" targets and which ones are "supporting" targets.

Note I work in a locked-down environment so downloading third-party software or ant extensions is not an option.

Additional Note If this level of detail is not possible in ant, that is a valid answer as well

like image 751
StormeHawke Avatar asked Sep 18 '25 12:09

StormeHawke


1 Answers

In Ant 1.8.2 and above, use the -d flag to print debug info:

ant -p -d <your main build file>

and you'll get details like this:

 javadoc
   depends on: resolve
 javadoc.distribute
 latest-ivy
 package
   depends on: -maybe-package-by-bom, -maybe-package-by-spec, -maybe-package-for-dc

The -d flag will also print the "other" targets (those without descriptions) that aren't printed by ant -p, along with their dependencies.

like image 134
gareth_bowles Avatar answered Sep 20 '25 00:09

gareth_bowles