对于 Maven,有没有办法跳过包中的所有测试?
For Maven, is there a way to skip all the tests in a package?
当我运行进行单元测试时,我想跳过一个包中的所有测试,但我需要确保其他包中的测试正常工作。
简而言之,现在有三个包:
com.felix.a, com.felix.b 和 com.felix.c,
我不希望 com.felix.c 中的测试 class 成为 运行.
我尝试通过maven-surefire-插件过滤包,但是没有生效
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<excludes>
<exclude>${basedir}/src/test/java/com/felix/c/*</exclude>
</excludes>
</configuration>
</plugin>
谢谢!
只需从您的排除中删除前导 ${basedir}/src/test/java/
,它就会起作用,因为插件已经暗示了这一点。从 documentation 开始,也可以使用完全限定的包名称来表示(可以说)更清晰:
<configuration>
<excludes>
<exclude>com.felix.c.*</exclude>
</excludes>
</configuration>
当我运行进行单元测试时,我想跳过一个包中的所有测试,但我需要确保其他包中的测试正常工作。
简而言之,现在有三个包: com.felix.a, com.felix.b 和 com.felix.c, 我不希望 com.felix.c 中的测试 class 成为 运行.
我尝试通过maven-surefire-插件过滤包,但是没有生效
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<excludes>
<exclude>${basedir}/src/test/java/com/felix/c/*</exclude>
</excludes>
</configuration>
</plugin>
谢谢!
只需从您的排除中删除前导 ${basedir}/src/test/java/
,它就会起作用,因为插件已经暗示了这一点。从 documentation 开始,也可以使用完全限定的包名称来表示(可以说)更清晰:
<configuration>
<excludes>
<exclude>com.felix.c.*</exclude>
</excludes>
</configuration>