This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Gradle forcing test task to run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Gradle forcing test task to run" Watch "Gradle forcing test task to run" New topic
Author

Gradle forcing test task to run

Wirianto Djunaidi
Ranch Hand

Joined: Mar 20, 2001
Posts: 210

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

Joined: Jan 10, 2013
Posts: 13

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 }
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Gradle forcing test task to run
 
Similar Threads
from ant, maven to gradle
ant calling a target that depends on its parent target
Ant build problem
Problem In Import Spring 3 Library
Build Hibernate sources