我有一个 pom.xml 文件,其中包含 surefire:test 插件,并且有两个配置文件来运行不同的测试模块/测试。我试图通过命令“mvn surefire:test -PfirstProfile,secondProfile”运行这些。但是这里只有用 pom.xml 编写的第二个配置文件被执行。这个命令是 apache maven 网站推荐的。这是我的 pom.xml 文件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.surefire.version}</version>
<configuration>
<forkMode>always</forkMode>
<!-- <testFailureIgnore>true</testFailureIgnore> -->
<failIfNoTests>false</failIfNoTests>
<skipTests>${skipTests}</skipTests>
<runOrder>${testRunOrder}</runOrder>
</configuration>
</execution>
</executions>
</plugin>
<profile>
<id>firstProfile</id>
<properties>
<skipTests>false</skipTests>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.surefire.version}</version>
<configuration>
<includes>
<include>**/AbcTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>SecondProfile</id>
<properties>
<skipTests>false</skipTests>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.surefire.version}</version>
<configuration>
<includes>
<include>**/xyzTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
那么我如何同时运行这两个配置文件呢?我也尝试了执行 ID。但它不起作用。