ProcessResources does not delete output when its input is deleted

We bumped into a problem when we used incremental build while some resources were deleted from src/main/resources. After a successful incremental build the resources are still under build/resources/main. It happens with Gradle 2.7 also.

It is very easy to reproduce. Just add a file under src/main/resources, do a clean build, delete the file, do an incremental build. And the file is still under build/resources/main.

Just a side note: if I delete a “.java” file from src/main/java and do an incremental build then the corresponding “.class” file is deleted from the build/classes folder. I expected similar behavior from processResources task.

An incremental build should clean out stale resources. The only instance when this doesn’t happen is when all files are removed (leaving no inputs) which causes the task to be skipped. This is an outstanding issue GRADLE-2579.

This is exactly what I did, removed the last property file from resources. Thanks for the answer. I try to use the workaround mentioned in GRADLE-2579.