Resetting the UP-TO-DATE property of gradle tasks?

前端 未结 4 1774
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 17:14

Is there a way I can force a gradle task to run again, or reset all tasks back to the not UP-TO-DATE state?

4条回答
  •  半阙折子戏
    2020-12-07 17:50

    If you want just a single task to always run, you can set the outputs property inside of the task.

    outputs.upToDateWhen { false }
    

    Please be aware that if your task does not have any defined file inputs, Gradle may skip the task, even when using the above code. For example, in a Zip or Copy task there needs to be at least one file provided in the configuration phase of the task definition.

提交回复
热议问题