Files processed with ReplaceTokens are still considered up-to-date if the value of one of the placeholder changes


given the following tasks:

task createProperty(type: Copy) {
  from "configuration"
  into "$buildDir/configuration"
  filter(, tokens: project.ext.getProperties())

and given the following content in my project directory:


and given the following content for a file located in configuration directory:


When I run for the first time the tasks, the content of the file generated will rightfully replace the placeholder by “aValue”.

But if afterward, I edit to change the value or use the -P command line options like -PmyProperty=anotherValue, gradle will go over the task saying that it is up-to-date and will not rewrite the value in the target configuration file.

The only workaround I have is to specified --rerun-tasks on the command line.

I am probably doing something wrong, but I cannot find what …

By the way I’m using gradle 1.9.

This is a long standing issue: GRADLE-1646

The workaround is to explicitly register your inputs.

createProperty { project.ext.getProperties()

Thanks it works perfectly.