Reputation: 11
The following maven command shows the dependency tree on console if run in the project directory where pom.xml is present.
mvn dependency:tree
What is the command which does the same in Ivy?
Upvotes: 1
Views: 582
Reputation: 558
This kept on coming up in the top of my search when I was looking at this earlier
This only requires the additions to the build.xml
for a target (or two if you include the resolve target). And I've included the configurations addition to ivy.xml
which means that you skip the test resources that will otherwise bloat the requirements for a compilation step. The output was simplified for brevity
build.xml
<target name="dependencytree" depends="resolve">
<ivy:settings file="../common/ivysettings.xml"/>
<ivy:dependencytree />
</target>
<target name="resolve" description="resolve compile dependencies">
<ivy:settings file="../common/ivysettings.xml"/>
<ivy:resolve conf="compile"/>
</target>
ivy.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0">
<info organisation="awesomeOrg" module="app" status="integration">
</info>
<configurations>
<conf name="test" visibility="public" />
<conf name="compile" visibility="public" />
</configurations>
<dependencies>
<dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.13.1" conf="compile"/>
<dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.13.1" conf="compile"/>
<dependency org="org.jctools" name="jctools-core" rev="3.3.0" conf="compile"/>
<dependency org="junit" name="junit" rev="4.13.2" conf="test"/>
<exclude org="org.jetbrains.kotlinx" module="lincheck" conf="compile"/>
<exclude org="com.google.guava" module="guava-testlib" conf="compile"/>
</dependencies>
</ivy-module>
And lastly from the commandline:
$ ant -f app/build.xml depedencytree
....
[ivy:resolve] resolve done (1733ms resolve - 51ms download)
dependencytree:
Overriding previous definition of property "ivy.version"
[ivy:dependencytree] Dependency tree for app
[ivy:dependencytree] +- org.apache.httpcomponents#httpcore;4.4.3
[ivy:dependencytree] +- org.swinglabs#swingx;1.6.1
[ivy:dependencytree] | +- com.jhlabs#filters;2.0.235
[ivy:dependencytree] \- org.swinglabs#swing-worker;1.1
[ivy:dependencytree] +- org.objenesis#objenesis;2.6
[ivy:dependencytree] +- it.tidalwave.betterbeansbinding#betterbeansbinding-el;1.3.0
[ivy:dependencytree] \- com.google.code.findbugs#jsr305;1.3.7
[ivy:dependencytree] +- org.postgresql#postgresql;42.5.1
BUILD SUCCESSFUL
Total time: 2 seconds
Upvotes: 0
Reputation: 10202
That would be dependencytree ant task, it "ASCII draws" a dependency tree in the console. It's simple - there's no parameters/xml attributes or child nodes, just write <dependencytree />
Upvotes: 0