Hi,

I'm struggling with the following and running out of options I can think of...

The original issue was that JaCoCo had a different coverage than IntelliJ (java 
code running via maven).

Diving into the JaCoCo coverage report I found out that a complete package was 
simply not covered. In the sessions of JaCoCo, the classes of that package were 
also not listed. (Other packages had no issues and had coverage and where also 
listed in the sessions) 

I dumped the classes by specifying a classDumpDir and there only the test 
classes of that package were dumped. The classes under test were nowhere to be 
found.

I already found out that the only reason for a class not to be dumped, is that 
it's filtered prior to instrumentation (see 
https://github.com/jacoco/jacoco/blob/master/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/CoverageTransformer.java#L85
 ) and that these are the only reasons to be filtered: ( see 
https://github.com/jacoco/jacoco/blob/master/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/CoverageTransformer.java#L113-L132
 )

- they are explicitly excluded / not included according to your configuration
- their class loader excluded according to your configuration ( see agent 
option "exclclassloader", which defaults to "sun.reflect.DelegatingClassLoader" 
)
- their class loader does not preserve source location ( see agent option 
"inclnolocationclasses", which defaults to "false" )
- they are loaded by a bootstrap class loader

Next to that I also learned that there's a known limitation in JaCoCo, namely 
that it has no coverage for exceptions. 
The latter isn't what's happening here as there are also tests without 
exceptions in them and even when I remove these tests altogether, the issue 
stays the same.

So based upon the info from above I tried the following section in the pom:

  <plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>${jacoco.version}</version>
    <executions>
      <execution>
        <id>agent</id>
        <goals>
          <goal>prepare-agent</goal>
        </goals>
      </execution>
      <execution>
        <id>report</id>
        <phase>site</phase>
        <goals>
          <goal>report</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <propertyName>jacoco.agent.argLine</propertyName>
      <!-- default: argLine -->
      <includes>
        <include>com/sometool/**</include>
      </includes>
      <exclClassLoaders>false</exclClassLoaders>
      <inclBootstrapClasses>true</inclBootstrapClasses>
      <inclNoLocationClasses>true</inclNoLocationClasses>
      <destFile>${project.build.directory}/jacoco-integration.exec</destFile>
      <!-- agent -->
      <dataFile>${project.build.directory}/jacoco-integration.exec</dataFile>
      <!-- report -->
    </configuration>
  </plugin>

But still I have no classes dumped by JaCoCo from that package let alone some 
coverage....

Any help would be greatly appreciated. Probably it's something simple but I'm 
simply not seeing it.

Marco

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/1732c74e-df37-4c64-a8e9-007b37a2bfce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to