user1137387
user1137387

Reputation: 2043

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?

Upvotes: 50

Views: 65303

Answers (4)

For me worked as @Ganesh Thorat.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>3.2.5</version>
  <configuration>
      <forkCount>0</forkCount>
  </configuration>
</plugin>

Upvotes: 0

Ganesh Thorat
Ganesh Thorat

Reputation: 592

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>

Upvotes: 4

Abhishek D K
Abhishek D K

Reputation: 2427

encountered the same issue

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.1</version>
    <configuration>
        <useSystemClassLoader>false</useSystemClassLoader>
    </configuration>
</plugin>  

set "useSystemClassLoader as false"

Upvotes: -1

user1137387
user1137387

Reputation: 2043

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>

Upvotes: 35

Related Questions