Continuous build: File watcher regression in 2.11

In a project with the war plugin applied, tasks that take src/main/webapp as an input directory fail to correctly watch this directory when run as a dependency of the classes task. There’s probably a non-plugin-specific cause, but I can’t pinpoint it.

Gradle Version: 2.11 through 3.1
Last worked correctly in: 2.10
Operating System and JVM version: Arch Linux 64-bit, OpenJDK 1.8.0_102
Related to: GRADLE-3415

To reproduce:

  • Clone https://github.com/delego-wlritchi/gradle-watch-bug
  • Run ./gradlew classes -t
  • In a new terminal, modify a file under src/main/webapp. Observe that the build is not retriggered.
  • Now modify the toplevel file. Observe that the build is retriggered as expected.

This bug appears to be related to GRADLE-3415, especially as it was introduced in the same version. However, the fix in 2.13 did not resolve this bug.

Opened in Github Issues as https://github.com/gradle/gradle/issues/756