The Analyzer does not offer a filtering. You would need to traverse the JAR file contents yourself and do the filtering.

Another (nicer) option would be to implement a filtering ICoverageVisitor which you plug between the Analzer and the CoverageBuilder.

Regards,
-marc

On 29.04.15 20:59, Krishantha Samaraweera wrote:
Hi Marc,

Thanks for your prompt reply!

I found the problem. There was jar file which contain another jar with com.sum classes. My simple grep command on all jars didn't list that jar. Excluding the parent jar from coverage did the trick.

I've another small clarification. In my project all packages are bundle as jars. So for ReportGenerator, i've set "classesDirectory" to the location of all jar files. In that case, how can i exclude a particular class in a jar file. At the moment only jar files can be passed to analyzer.analyzeAll(file) method after filtering according to the exclusion defined. How can I exclude specific class files (not the jar file) in this case.

Thanks,
Krishantha.


On Wed, Apr 29, 2015 at 11:49 PM, Marc R. Hoffmann <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    if you exclude classes at the agent configuration this simply
    means that the agent does not collect execution data for those
    classes.

    If you want exclude classes from the report you have to filter
    those classes at report generation time. If you're working with
    the analyzer you need to provide only the class files you want to
    see in the report.

    Regards,
    -marc


    On 29.04.15 19:25, [email protected]
    <mailto:[email protected]> wrote:

        Hi All,

        I'm trying to generate coverage by excluding com.sun.*
        classes. Only one jar containing com.sum.* packages is there
        in the server. I've excluded that jar from coverage report by
        filter out all jar files and passing the jar names to
        analyzeAll method though a loop when generating the report.

        Note that I'm using modified version of ReportGenerator at [1]

        analyzer.analyzeAll(file);

        Also excluded that particular patten from -javaagent option.

        
-javaagent:/Users/krishantha/git/wso2/product-as/modules/integration/tests-integration/tests/target/jacoco/agent/jacocoagent.jar=destfile=/Users/krishantha/git/wso2/product-as/modules/integration/tests-integration/tests/target/jacoco.exec,append=true,includes=org.test.myapp*:org.addressing*:org.test.application.deployer*:,excludes=com.sun**:org.eclipse.*:*.equinox.*,classdumpdir=/Users/krishantha/Desktop/test
        \

        Also I have dump all classes to a directory and no com.sun
        classes are there.

        However still my report contain com.sun packages.

        Any help to exclude the classes properly will be appreciated.

        Sample report is given below
        =============================

Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes
        \
com.sun.activation.registries 3,976 0% 516 0% 368 368 492 492 104 104 14 14 com.sun.activation.viewers 1,054 0% 0% 62 62 149 149 44 44 8 8 com.sun.codemodel 10,994 0% 1,042 0% 1,246 1,246 2,325 2,325 724 724 80 80 com.sun.codemodel.fmt 0% 0% 46 46 105 105 36 36 9 9 com.sun.codemodel.util 2,086 0% 120 0% 107 107 222 222 47 47 9 9

        
[1]http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java

        Thanks,
        Krishantha.


-- You received this message because you are subscribed to a topic in
    the Google Groups "JaCoCo and EclEmma Users" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/jacoco/4kNrcAhiqy4/unsubscribe.
    To unsubscribe from this group and all its topics, send an email
    to [email protected]
    <mailto:jacoco%[email protected]>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/jacoco/55412095.5080508%40mountainminds.com.


    For more options, visit https://groups.google.com/d/optout.


--
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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/CAAws007wsicTWQhuMddjwbGuMt%3DjT43PBJe3JVPNOyb9K_JHQA%40mail.gmail.com <https://groups.google.com/d/msgid/jacoco/CAAws007wsicTWQhuMddjwbGuMt%3DjT43PBJe3JVPNOyb9K_JHQA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
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/554134D5.6040501%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to