How can I avoid Gradle complaining about missing dependencies during clean?

I have a project that is one of many loosely-coupled projects, all projects are compiled in a certain order outside of gradle using a simple script. I.e. these are not part of a Gradle multi-project build with sub-projects.

Project 1 will build an asset that is consumed by Project 2 (as a normal dependency)

The problem is the very first time you check out the code, if you run a ‘clean’ none of the assets exist yet and so Project 2 complains that the dependency can’t be found. It doesn’t need the dependencies to do a clean though!

For now I have hacked around it by specifying a property on the command line -PnoDependencies=true when doing a clean. And just wrapping my dependency declarations with a check to make sure that property isn’t set. I expected Gradle to realize that the dependencies weren’t needed (they are never referenced in any task that runs as part of a clean).

Sounds like you are accidentally resolving dependencies in the configuration phase.

What would that look like? I have a couple tasks that depend on a configuration, but those tasks aren’t running during a clean.

E.g. I’m guessing something like this is the problem:

task copyToStagingArea(type: Copy, dependsOn: [configurations.resourceZip, configurations.pluginZip]) {

into project.stagingDir

// Base SDK files

configurations.resourceZip.files.each {

if (".zip")) {





But how else should I do it?

That’s indeed a problem. There are various ways to solve it. For example, ‘from { configurations.resourceZip.findAll {".zip") }.collect { zipTree(it) } }’ should work.