Search code examples
mavenjunitmaven-surefire-plugin

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>

Solution

  • So I added the following Code to my pom.xml

    <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M3</version>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    

    The Error Message changed:

    [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] Error occurred in starting fork, check output in log [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: Error occurred in starting fork, check output in log [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:623) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)

    Edit

    I finally found my problem, in my path to the folder there was an '&' and windows couldn't handle it. This was the reason for the different Error Messages