Maven命令不排除任何内容,尽管在pom中排除了条目



尽管pom.xml文件中的surefire插件配置下有<exclude>条目,但哪个maven命令可以用于执行所有测试?

例如-下面是pom.xml中的部分,但我不想排除TestA.java。可以使用哪个maven命令?

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/TestA.java</exclude>
</excludes>
</configuration>
</plugin>

将配置文件添加到pom.xml

<profiles>
<profile>
<id>all-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude></exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

此配置文件覆盖了surefire插件的排除部分。只需通过以下方式激活配置文件:

mvn clean install -Pall-tests

最新更新