**DISCLAIMER:** none of this has been tested with an Android build.

As I said, you could use SpringSource's propdeps-plugin to bring `provided` and `optional` configurations (and use either one for dagger-compiler), or you could (untested) use something like that:

```groovy
configurations {
  apt
}
dependencies {
  apt "com.squareup.dagger:dagger-compiler:$daggerVersion"
}
tasks.withType(JavaCompile).each { task ->
  task.classpath.add(configurations.apt)
}
```

or (this is what the propdeps-plugin does, more or less)

```groovy
configurations {
  apt
}
dependencies {
  apt "com.squareup.dagger:dagger-compiler:$daggerVersion"
}
// XXX: I don't know if there's a way to address all source sets
sourceSets.main.java.compileClasspath += configurations.apt
```

or

```groovy
configurations {
  apt
}
dependencies {
  apt "com.squareup.dagger:dagger-compiler:$daggerVersion"
}
tasks.withType(JavaCompile).each { task ->
  task.options.compilerArgs += [ '-processorpath', configurations.apt.asPath ]
}
```

(see also http://stackoverflow.com/a/18687395/116472 and http://stackoverflow.com/a/17999249/116472 –they add a `-s` flag to javac for better integration with Android Studio, IIUC–, and the [gradle-androidannotations-plugin](https://github.com/ealden/gradle-androidannotations-plugin))