Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Surefire plugin "Error occured in starting fork, check output in log"

I get the following error

BUILD ERROR
Error occured in starting fork, check output in log

when using Maven 2.2.1 and Surefire plugin 2.11 while running junit test cases.

How can I fix it?

like image 401
user1137387 Avatar asked Feb 16 '12 23:02

user1137387


2 Answers

You need to setup surefire plugin to use <forkMode>once</forkMode> like this:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.5</version>
            <configuration>
                <skipTests>false</skipTests>
                <testFailureIgnore>true</testFailureIgnore>
                <forkMode>once</forkMode>
            </configuration>
</plugin>
like image 175
user1137387 Avatar answered Nov 06 '22 02:11

user1137387


I was facing the same issue on my local with maven-surefire-plugin plugin.

After adding <forkCount>0</forkCount> to maven-surefire-plugin plugin it worked for me.

        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <argLine>-Xmx1024m -XX:MaxPermSize=256m ${surefireArgLine}</argLine>
                <includes>
                    <include>**/*Test.java</include>
                </includes>
                <forkCount>0</forkCount>
            </configuration>
        </plugin>
like image 4
Ganesh Thorat Avatar answered Nov 06 '22 00:11

Ganesh Thorat