Sync task considers project up-to-date even though files are added to destination dir


(gradle) #1

(Please note: This question was already asked here.)

I’m using this simple Gradle task:

task syncTask(type: Sync) {
    from "src/"
    into "dest/"
}

According to the docs, I’m expecting that src is copied to dest and that any files not present in src are removed from dest. This basically works fine. However, if there are files added to dest after syncing, this is not recognized when the task runs again. The project is simply considered UP-TO-DATE and no action is taken.

Is it possible to configure the Sync task so that added files in the destination directory are detected and the task is run again?

> gradle -v
  ------------------------------------------------------------
Gradle 1.9
------------------------------------------------------------
  Build time:
 2013-11-19 08:20:02 UTC
Build number: none
Revision:
   7970ec3503b4f5767ee1c1c69f8b4186c4763e3d
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:
        2.2.0
JVM:
        1.7.0_25 (Oracle Corporation 23.7-b01)
OS:
         Linux 3.2.0-53-generic amd64