How to run Maven surefire without printing out test results to the command line?

maven, maven-surefire-plugin

Solution

Try setting the `surefire.printSummary` property to `false`: this should only print the test cases that have errors. So try running it as `mvn -q -Dsurefire.printSummary=false`.

Alternatively, you can put it in your pom.xml:

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

Problem

I am running the Maven 3.1.0 Surefire plugin already with the `--quiet` option, however it still prints out the results of unit tests out to the command line, even if they all pass. Is there a way to only get it to print failures? The output I'd like to suppress if everything is fine looks like: ``` ------------------------------------------------------- T E S T S ------------------------------------------------------- Running net.initech.project.dawgs.actionfactory.InterfaceActionFactoryTest Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.425 sec Running net.initech.project.dawgs.actionfactory.ValueScopeTest Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec Running net.initech.project.dawgs.assertion.AssertContainsTest Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 sec Running net.initech.project.assertion.AssertEndsWithTest Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 sec Running net.initech.project.assertion.AssertIsEqualTest Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec Running net.initech.project.assertion.AssertIsLikeTest Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 sec Running net.initech.project.assertion.AssertStartsWithTest Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec Results : Tests run: 52, Failures: 0, Errors: 0, Skipped: 0 ``` No, I do not want to pipe the output to `/dev/null`

Original source