maven-surefire-plugin的插件提供了对测试目录的配置,想要细看的或者学习更多东西的可以去http://maven.apache.org/surefire/maven-surefire-plugin学习.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration> <includes> <include>**/Test1.java</include> <include>**/Test2.java</include> </includes> <excludes> <exclude>**/Test3.java</exclude> <exclude>**/Test4.java</exclude> </excludes> </configuration>
</plugin>
或者
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.17</version> <configuration> <includes> <include>com/test/action/*Test.java</include>
</includes> <excludes> <exclude>com/test/action2/*Test.java</exclude> </excludes> </configuration> </plugin>