FusionReactor Observability & APM

Troubleshoot

Blog / Info

Customers

About Us

Installation

Configure

Troubleshoot

Blog / Info

Customers

About Us

Maven Surefire Stack Trace Problem

For some months we have been having problems with maven-surefire-plugin showing very strange exception stack traces.

After some searching, I found out that maven-surefire-plugin has a trimStackTrace configuration option which is set to true by default. See http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#trimStackTrace

I have no idea who thought that removing part of the stack trace would be a good idea, but it’s caused us no end of problems. Especially with rare/random test failures as we don’t get the full stack trace to see what really failed.

To change this ‘feature’ you simply define surefire configuration in your pom.xml. E.g.

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

You should also be aware that maven-failsafe-plugin has the exact same option. The trimStackTrace is also set to true by default. See https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html

You can disable this by adding the same configuration to the failsafe plugin. E.g.

 

<configuration>
    <trimStackTrace>false</trimStackTrace>
</configuration>