Code coverage in maven build - Skipping JaCoCo execution due to missing classes directory

berimbolo

I am able to get code coverage working fine if I have a single project but now I have a multi module project.

My application is built in the api project and all my integration tests are running in a separate project which uses the artefact built as previous module.

The build runs but I dont get a code coverage report, instead I get the info message:

Skipping JaCoCo execution due to missing classes directory

My coverage report file jacoco-it.exec is created but it seems like the jacoco plugin requires the classes in the project the tests are running in.

Can somebody tell me what I need to do to be able to create a coverage report when the classes are in another module?

berimbolo

I have managed to get a workaround of sorts going through trial and error.

It seems the jacoco plugin is happy to create the exec file without the classes but it will not create the report without them, I dont understand how jacoco is working internally so if someone knows could you please explain it?

I am also not sure if what I have done is reliable but it does seem to report the coverage of my selenium driven tests.

My (possible) solution which I have come up with myself is to use the maven resources plugin to copy the classes which have been exploded from the war file in my target\cargo.. directory into the directory target\classes:

 <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>copy-resources</id>             
            <phase>pre-integration-test</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/classes</outputDirectory>
              <resources>          
                <resource>
                  <directory>${basedir}/target/cargo/configurations/tomcat7x/webapps/calculator-api/WEB-INF/classes</directory>
                  <filtering>false</filtering>
                  <excludes>
                        <exclude>**/*Config*.*</exclude>
                        <exclude>**/*Initialiser*.*</exclude>
                  </excludes>
                </resource>
              </resources>              
            </configuration>            
          </execution>
        </executions>
    </plugin>

This seems to keep the jacoco plugin happy and I get my code coverage, although it seems the plugin ignores my exclude list now.

Does anybody know if this is actually a solution, it 'seems' to work but I cant find anywhere online where this is a recommended approach and I am also unsure of why the exclude option on the jacoco agent set up no longer seems to work.

I have managed to get around the jacoco plugin not excluding files by just not copying them with the resources plugin but I still dont understand exactly how jacoco is working.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Code coverage in maven build - Skipping JaCoCo execution due to missing classes directory

From Dev

Missing Jacoco Code Coverage and IncompatibleClassChangeError

From Dev

maven jacoco: not generating code coverage report

From Dev

Sonar maven jacoco code coverage for Multimodule project

From Java

Generate Code Coverage with JaCoCo and spring-boot-maven-plugin

From Dev

Jacoco 0% Code Coverage

From Dev

java code coverage with jacoco

From Dev

Jacoco 0% Code Coverage

From Dev

Jacoco coverage of unit test code

From Dev

Jacoco Code Coverage in android studio

From Dev

Code coverage with jacoco for a Android library

From Dev

Jacoco code coverage is affected by AspectJ

From Dev

Jacoco complains about unlikely missing branch coverage

From Dev

JaCoCo coverage report setups(exclude test classes)

From Dev

JaCoCo coverage report setups(exclude test classes)

From Dev

How to check minimum code coverage for multi-module maven project with jacoco?

From Dev

How can I exclude files of the Code Coverage of SonarQube using JaCoCo maven plugin

From Dev

Jacoco Maven multi module project coverage

From Dev

maven jacoco plugin does not generate coverage report

From Dev

Junit Coverage using Jacoco with ant build

From Dev

Junit Coverage using Jacoco with ant build

From Dev

Android - Jacoco code coverage ignores Robolectric tests

From Dev

Gradle - Jacoco code coverage without running connectedCheck

From Dev

Why might Jacoco be showing a code coverage of 0?

From Dev

Minimum code coverage threshold in Jacoco Gradle

From Dev

How to check code coverage with JaCoCo agent?

From Dev

How to exclude a line from jacoco code coverage?

From Dev

Jacoco: Find code coverage for external tests

From Dev

Android - Jacoco code coverage ignores Robolectric tests

Related Related

  1. 1

    Code coverage in maven build - Skipping JaCoCo execution due to missing classes directory

  2. 2

    Missing Jacoco Code Coverage and IncompatibleClassChangeError

  3. 3

    maven jacoco: not generating code coverage report

  4. 4

    Sonar maven jacoco code coverage for Multimodule project

  5. 5

    Generate Code Coverage with JaCoCo and spring-boot-maven-plugin

  6. 6

    Jacoco 0% Code Coverage

  7. 7

    java code coverage with jacoco

  8. 8

    Jacoco 0% Code Coverage

  9. 9

    Jacoco coverage of unit test code

  10. 10

    Jacoco Code Coverage in android studio

  11. 11

    Code coverage with jacoco for a Android library

  12. 12

    Jacoco code coverage is affected by AspectJ

  13. 13

    Jacoco complains about unlikely missing branch coverage

  14. 14

    JaCoCo coverage report setups(exclude test classes)

  15. 15

    JaCoCo coverage report setups(exclude test classes)

  16. 16

    How to check minimum code coverage for multi-module maven project with jacoco?

  17. 17

    How can I exclude files of the Code Coverage of SonarQube using JaCoCo maven plugin

  18. 18

    Jacoco Maven multi module project coverage

  19. 19

    maven jacoco plugin does not generate coverage report

  20. 20

    Junit Coverage using Jacoco with ant build

  21. 21

    Junit Coverage using Jacoco with ant build

  22. 22

    Android - Jacoco code coverage ignores Robolectric tests

  23. 23

    Gradle - Jacoco code coverage without running connectedCheck

  24. 24

    Why might Jacoco be showing a code coverage of 0?

  25. 25

    Minimum code coverage threshold in Jacoco Gradle

  26. 26

    How to check code coverage with JaCoCo agent?

  27. 27

    How to exclude a line from jacoco code coverage?

  28. 28

    Jacoco: Find code coverage for external tests

  29. 29

    Android - Jacoco code coverage ignores Robolectric tests

HotTag

Archive