Iterate all (including transitive) dependencies with a given groupId for a project?


(tulsoba) #1

I am writing a custom plugin where I need to iterate all dependencies for a war project including its transitive dependencies but only for a given groupId. Is there build-in functionality in gradle for this or do I need to write my own script for this?


(Luke Daley) #2

Which version of Gradle do you need to target? Gradle 1.2 has better API for this.


(tulsoba) #3

I am using 1.2 and currently use more less the approach described here:

http://gradle.1045684.n5.nabble.com/transitive-dependency-list-td4793535.html


(Luke Daley) #4

And how is that not working for you?


(tulsoba) #5

sorry it works :slight_smile: But maybe there was a simpler way like: project.getDependencyTree() that would eg. return an iterator to the root.


(Luke Daley) #6

Gradle 1.2 introduced a new (incubating) API that may be easier to work with depending on what you want: http://gradle.org/docs/current/release-notes#dependency-resolution-result-api

Its focus is slightly different.