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

user1137387 picture user1137387 · Feb 17, 2012 · Viewed 30.5k times · Source

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?

Answer

user1137387 picture user1137387 · Feb 17, 2012

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>