Gradle stack trace on terminal
I'm required to use Gradle for my Java project.
I'm running some unit tests with ./gradlew test
, but the exception stack trace is witten on a web page which I need to load in a browser.
Why such complication?
Is there a way of getting it on the terminal instead, as I Maven does?
According to this page the following will do:
test {
testLogging {
exceptionFormat = 'full'
}
}
This is actually working. It's not really showing the whole exception trace, but (even better?) it shows the relevant part of it (that is, the part associated to the code written in the unittest).
For gradle (kotlin dsl) you could do this:
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
tasks {
test {
testLogging {
events("passed", "skipped", "failed")
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
}
}
}