This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 Java 8 in Action this week in the Java 8 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
Build Hibernate sources
Ant build problem
ant calling a target that depends on its parent target
from ant, maven to gradle
Problem In Import Spring 3 Library