Unfortunately it seems that if something is set in the pom it is not easily overridden (if you set skipTests
explicitly it'd be hard to override with a property as well)... But! (and this is a bit of a hack) you can defer the setting of the property, to a pom property, and then override it on the command line.
<project>
...
<properties>
<groups>!Slow</groups>
<properties>
....
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<groups>${groups}</groups>
</configuration>
</plugin>
</plugins>
</build>
...
With this (and a quick built out project, running on OSX, Maven 3.0.4, Java 1.6.0_37):
$ mvn clean test
...
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
...
$ mvn clean test -Dgroups=Slow
...
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0