Gradle custom task

I have a custom task to generate some files. I also have compileJava dependsOn customTask. After testing a couple of times, because of UP-TO-DATE, the customTask is not running even though i am running clean build and the files that are generated by customTask doesnt exist. I am using gradle 2.12.

Please suggest a solution.