Maven 故障安全插件在并行运行时忽略线程数

问题描述

我有这个 maven-failsafe-plugin 执行配置:

<plugin>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.16</version>
    <executions>
        <!-- ... other executions -->

        <execution>
            <id>multi-threaded-test-run</id>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
            <configuration>
                <skipITs>${skipParallel}</skipITs>
                <excludes>
                    <exclude>**/AA_*.java</exclude>
                    <exclude>**/ZZ_*.java</exclude>
                </excludes>
                <excludedGroups>com.snc.mobile.sg.core.attributes.SGNotThreadSafe</excludedGroups>
                <parallel>classesAndMethods</parallel>
                <threadCount>20</threadCount>
                <argLine>-XshowSettings:vm -Xms128m -Xmx3072m -XX:MaxMetaspaceSize=1024m</argLine>
            </configuration>
        </execution>

        <!-- ... other executions -->
    </executions>
     <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit47</artifactId>
            <version>2.17</version>
            <scope>compile</scope>
          </dependency>
    </dependencies>
<plugin>

在实际运行测试时,Maven(或者它是 Junit?)似乎完全忽略了我给它的任何线程数,并行运行所有测试。

我还尝试了其他配置,包括将 parallel 设置为仅 methods,以及设置更具体的线程计数 (threadCountClasses/threadCountMethods)。

我在这里做错了什么?

附言假设 skipParallel 始终为 false,这不是问题,执行确实会运行。

谢谢,阿维。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)