Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Surefire: Error occured in starting fork

When I am trying to run

mvn test

I always get the Error Message that maven-surefire error ocurred in starring fork. It has something to do with my local settings, on my colleagues PC it's working fine. I hope that somebody has an idea what is wrong with my pc :)

A part of the Error Message:

  1. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project exercise00-assignment01: Error occurred in starting fork, check output in log -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project exercise00-assignment01: Error occurred in starting fork, check output in log

  2. Caused by:
        org.apache.maven.surefire.booter.SurefireBooterForkException: Error
        occurred in starting fork, check output in log
            at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork
        (ForkStarter.java:284)
    

I am using win10, jdk: 1.8.0_202, maven: 3.6.0

My pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>at.tuwien.swtesting</groupId>
    <artifactId>exercise00-assignment01</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>jar</packaging> 

    <name>01-RingBufferTest</name>
    <description>Entry exercise.</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>  
        <dependency>  
            <groupId>junit</groupId>  
            <artifactId>junit</artifactId>  
            <version>4.12</version>  
            <scope>test</scope>  
        </dependency>  
    </dependencies>

</project>
like image 927
Elrond Avatar asked Jan 27 '23 12:01

Elrond


1 Answers

I recently stuck in the same issue. After a lot of research, I got below the resolution

ForkCount should be set as "0"

Update your pom file as:-

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
        <forkCount>0</forkCount>
        <suiteXmlFiles>`enter code here`
        <suiteXmlFile>testng.xml</suiteXmlFile>
        </suiteXmlFiles>
        </configuration>
    </plugin>
</plugins>

like image 126
Vcoder Avatar answered Jan 29 '23 03:01

Vcoder