Actually, it turns out that this is not possible to do with maven-surefire-plugin.
I found the answer here.
I actually end up using the solution proposed there by @mhaller
So I implemented a junit listener like this:
package br.com.xpto;
import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
import br.com.caelum.brutal.integration.scene.AcceptanceTestBase;
public class FailFastListener extends RunListener {
public void testFailure(Failure failure) throws Exception {
System.err.println("FAILURE: " + failure);
AcceptanceTestBase.close();
System.exit(-1);
}
@Override
public void testFinished(Description description) throws Exception {
AcceptanceTestBase.close();
System.exit(-1);
}
}
And configure maven-surefire like this:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>surefire-integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/scene/**/*Test.java</include>
</includes>
<forkMode>once</forkMode>
<properties>
<property>
<name>listener</name>
<value>br.com.caelum.brutal.integration.util.FailFastListener</value>
</property>
</properties>
</configuration>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/*</exclude>
</excludes>
</configuration>
</plugin>