Dependency resolution when running 'gradle tasks'?

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 {
  dependencies {
 zip ""
  task explodeApp(type: Copy, dependsOn: {
      from { zipTree( }
    into "${appDir}"
  // running hello task does not download zip file
task hello << {
 print "hello"

Here is the output:

% gradle hello
  % gradle tasks
All tasks runnable from root project
  Download http://myrepo//path/to/big/zipfile/1.0-SNAPSHOT/
[... waing long time on slow connection]


I think I asked this before and the answer was that the ‘tasks’ task is “special”.

You can prevent ‘tasks’ from resolving your dependencies by wrapping the ‘from …’ line inside a doFirst or doLast block.

You typically don’t want to do that though, since doing configuration during the execution phase will break up to date checking.

correct, so I mitigate that by putting a “inputs.files” line in the task configuration.