Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Gradle forcing test task to run

 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm playing with Gradle at this moment and I notice that Gradle is quite smart in term of not running any of the tasks when nothing has changed, including the 'test' task. However sometime I do want to run the test task even when nothing has changed, because I want to look at the test report in the case I lost the console buffer already. What is the way to force the test task to run even when there is no change to the project? Of course I'm looking for idiomatic Gradle way, not touching the project to fake a change .
 
Hubert Klein Ikkink
author
Greenhorn
Posts: 13
IntelliJ IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wirianto,

the easiest way is to first run cleanTest before the test task. So from the command-line you would enter:
$ gradle cleanTest test
or using task abbreviation:
$ gradle cT test

If you always want to run the test task you can add in your build file:
test.dependsOn 'cleanTest'
or define the task can never be UP-TO-DATE:
test.outputs.updateWhen { false }
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic