我使用的是scalatest-maven-plugin最新的 1.0 版本,这里有源代码。尝试并行运行我的套件并使用以下配置:
<build><plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
<htmlreporters>${project.build.directory}/html/scalatest</htmlreporters>
<parallel>true</parallel>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin></build>
导致以下 Maven 构建错误:
[INFO]
[INFO] --- scalatest-maven-plugin:1.0:test (test) @ myproject ---
Exception in thread "ScalaTest-main" java.lang.IllegalArgumentException: ERROR: -c has been deprecated for a very long time and is no longer supported, to prepare for reusing it for a different purpos
e in the near future. Please change all uses of -c to -P.
at org.scalatest.tools.ArgsParser$.checkArgsForValidity(ArgsParser.scala:46)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:857)
at org.scalatest.tools.Runner$.main(Runner.scala:827)
at org.scalatest.tools.Runner.main(Runner.scala)
基本上 scalatest-maven-plugin 传递-c
给 scalatest CLI 而不是正确的-P
.. 或者甚至更好-P10
,即要使用的线程数。
如何-P10
通过 Maven 将 scalatest 传递给 scalatest 进程?我已经尝试在MAVEN_OPTS
环境变量或 Maven CLI 中直接设置它,但它没有被拾取。
我也尝试过像这样配置 scalatest-maven-plugin:
<configuration>
<argLine>-P10</argLine>
</configuration>
但是这个参数被传递给java进程而不是Scalatest,所以它也失败了。