I have a question on lazy dependency resolution.
It seems to be working for me (using gradle 2.3) where my dependency only gets resolved if I run the task that depends on it.
The exception, however, is if I run ‘gradle tasks’. I’m surprised to discover it does attempt to to pull down my dependency. It was surprising to me since I was on a slow VPN connection and my zip dependency is large.
Why does ‘gradle tasks’ require dependencies to be resolved and is there a way to avoid it.
Here is a example of my code:
configurations {
zip
}
dependencies {
zip "path.to.big:zipfile:1.0-SNAPSHOT@zip"
}
task explodeApp(type: Copy, dependsOn: configurations.zip) {
from { zipTree(configurations.zip.singleFile) }
into "${appDir}"
}
// running hello task does not download zip file
task hello << {
print "hello"
}
Here is the output:
% gradle hello
:hello
hello
BUILD SUCCESSFUL
----------
% gradle tasks
:tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
Download http://myrepo//path/to/big/zipfile/1.0-SNAPSHOT/zipfile-1.0-20150306.195305-1.zip
[... waing long time on slow connection]
Thanks.