Maven 尽管分叉计数为>;1.
这是我的设置:Maven 尽管分叉计数为>;1.,maven,junit,junit4,maven-surefire-plugin,Maven,Junit,Junit4,Maven Surefire Plugin,这是我的设置: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration&
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<forkCount>1C</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reuseForks>true</reuseForks>
<argLine>-Xmx256m</argLine>
</configuration>
</plugin>
org.apache.maven.plugins
maven surefire插件
2.18.1
1C
真的
真的
-Xmx256m
我使用的是junit 4.12:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>4.12</version>
</dependency>
朱尼特
朱尼特
测试
4.12
但在启动测试时,我看不到任何分叉?
我在linux和JDK 8上使用maven 3.2.5。我运行了一个小调试(mvn-X test
),结果表明,尽管使用了4.12版,surefire并没有使用junit47
提供程序,而是使用junit4
提供程序。不幸的是,junit4
提供程序似乎无法处理forkCount
通过浏览文档,我可以找到以下选择提供程序的算法:
必须设置parallel
属性才能激活junit47
提供程序(有点违反直觉…)
我为此创造了一个JIRA:
现在,我的配置如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<parallel>classes</parallel>
<threadCount>1</threadCount>
<forkCount>1C</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reuseForks>true</reuseForks>
<argLine>-Xmx256m</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
<configuration>
<forkCount>1C</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reuseForks>true</reuseForks>
<argLine>-Xmx512m</argLine>
</configuration>
</plugin>