Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: task with a custom dependency configuration?

Tags:

gradle

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?

like image 882
Chris Kessel Avatar asked Feb 26 '14 17:02

Chris Kessel


1 Answers

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

like image 188
Peter Niederwieser Avatar answered Nov 06 '22 15:11

Peter Niederwieser