Chris Kessel
Chris Kessel

Reputation: 5865

Gradle: task with a custom dependency configuration?

My project has a bunch of modules and while each module applies the java plugin and has normal compile, test, jar, and such steps, the outer project doesn't. However, the outer project does have a task that wraps up a bunch of files, reports, and such and does some processing. This task needs a particular zip file that nothing else needs.

I need that task to resolve and download a dependency, so if I run:

gradle doWeeklySummaryTask

It'll go fetch the necessary zip, just like compile fetches all the compile dependencies.

I can create a custom dependency, that's easy enough:

configurations {
   foo
}
dependencies {
   foo('blah:blah:blah')
}

The question is, how do I get my doWeeklySummaryTask to resolve that dependency?

Upvotes: 6

Views: 7258

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123890

The dependency will be automatically resolved as soon as some piece of code iterates over configurations.foo.

Upvotes: 8

Related Questions