Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 尽管分叉计数为>;1._Maven_Junit_Junit4_Maven Surefire Plugin - Fatal编程技术网

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>