How to obtain dependency information in a custom plugin


(Mark Maxey) #1

There are a few Ivy Ant tasks I’d like to use, e.g., “report” & “makepom” based on the dependencies I’ve defined in Gradle. I can obviously use the AntBuilder to call Ant tasks, but its not clear to me where it would get its dependency information from.

How can I do this from a custom plugin?


(Szczepan Faber) #2

Best place to start is our DSL reference: http://gradle.org/docs/current/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.artifacts.Configuration

The link points to a Configuration object. It is a domain object responsible for resolving dependencies. An instance of a configuration provides access to dependency information. So, in your plugin you can do things like:

def dependencies = project.configurations.compile.dependencies