Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I ensure that the processResources task of a gradle build always runs?

Tags:

gradle

We have a strange issue where randomly and infrequently, the compileJava task which deletes the META-INF folder and compiled classes to start, runs but the processResources task reports up-to-date, even though the META-INF directory clearly doesn't exist.

This bites us big time because it's possible that the artifacts make it all the way to production without an applicationContext.xml!

It costs very little for us to run that task, is it possible to force it to run, no matter what?

like image 849
Tim Visher Avatar asked Nov 11 '11 18:11

Tim Visher


1 Answers

Maybe there's some kind of bug that fails to clear gradle cache. One possible solution would be to first force the task to clean its own output by running cleanProcessResources.

If that does not work then try overriding the upToDateWhen predicate of your task's outputs like this:

processResources.outputs.upToDateWhen{ false }

However I don't know if this API is permanent.

like image 199
rodion Avatar answered Oct 09 '22 14:10

rodion