Make maven's surefire show stacktrace in console

IAdapter picture IAdapter · May 28, 2010 · Viewed 31k times · Source

I'd like to see the stacktrace of unit tests in the console. Does surefire support this?

Answer

h7r picture h7r · Jun 5, 2013

A related problem that I found is that surefire in recent versions apparently sets trimStackTrace to true by default (rendering most stack trace in failed tests useless), which is quite inconvenient.

Setting -DtrimStackTrace=false or defining

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <trimStackTrace>false</trimStackTrace>
    </configuration>
</plugin>

solved this.