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

40,519

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>
Share:
40,519
user1137387
Author by

user1137387

Updated on July 16, 2022

Comments

  • user1137387
    user1137387 almost 2 years

    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?

  • Naman
    Naman over 6 years
    the option is deprecated, any updated combination to solve the issue?
  • Alban
    Alban about 6 years
    I fixed it with <forkCount>0</forkCount> (instead of the deprecated forkMode).
  • Simon Ninon
    Simon Ninon almost 6 years
    notice that forkMode once is NOT the same as forkCount 0.From maven.apache.org/surefire/maven-surefire-plugin/examples/…, the equivalent would be forkCount 1 with reuseForks true. However, seems forkCount 0 fixes the issue.
  • Mançaux Pierre-Alexandre
    Mançaux Pierre-Alexandre over 3 years
    with this you loose jacoco coverage on sonar...any other ideas because i m in the same situation. thanks