I guess you want this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
This will package the -test
classified jar. Be aware that if you use -DskipTests
, surefire and failsafe will skip the executions of the tests, while if you use -Dmaven.test.skip=true
tests will completely be ignored by surefire, failsafe and compiler.