0

I am using maven jacoco plugin for code coverage. I decided to exclude some classes from jacoco coverage report. I found here, how to do it.

So my updated pom file looks like this:

<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>

    <artifactId>payment-rest</artifactId>
    <packaging>war</packaging>

    <name>payment-rest</name>

    <parent>
        <artifactId>payment-ws</artifactId>
        <groupId>com.example.foo</groupId>
        <version>1.0.0-INTEGRATION-SNAPSHOT</version>
    </parent>

    <properties>
        <jacoco.line.coverage>0.78</jacoco.line.coverage>
        <jacoco.branch.coverage>1.00</jacoco.branch.coverage>
        <servlet.version>3.0.1</servlet.version>
    </properties>

    <dependencies>

     <!-- all dependecies here-->
    </dependencies>

    <build>
        <finalName>payment-ws</finalName>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            **/com/example/foo/payment/configuration/**.*
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <attachClasses>true</attachClasses>
                    <classesClassifier>classes</classesClassifier>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

So, when I am running mvn clean install command, I gets this error ():

Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

enter image description here

If I remove exclusion part, project builds successfully.

Can someone advise me how can I solve this issue?

Hutsul
  • 1,535
  • 4
  • 31
  • 51

1 Answers1

0

issue is occur because maven-surefire-plugin is missing into your project pom.xml. you need to add this plugin into pom.xml, after adding need to update and rebuild the project and run it.

you can find the maven plugin below:

 <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.19.1</version>
        </plugin>
  </plugins>

you can refer higher version from 2.19.1.

Anshul Sharma
  • 3,432
  • 1
  • 12
  • 17