problems with 'excludes='

64 views
Skip to first unread message

lvhu...@gmail.com

unread,
Aug 6, 2019, 11:52:07 PM8/6/19
to JaCoCo and EclEmma Users
hi guys,

I was using Jacoco to analyze my API interface tests. My class files have the following directories/packages:
com.X.Y.controller, com.X.Y.view, com.X.Y.view.model, com.X.Y.view.util, com.X.Y.util, com.X.Y.debug, com.X.Y.helper, etc. I wanted to use 'excludes=' to excludes the 'helper' and the 'debug' packages from the analysis scope, so in my java command line, I added this:
-javaagent:/path/to/lib/jacocoagent.jar=excludes=*.helper.*:*.debug.*,output=tcpserver,address=xxx,,port=xxx

I tried quite a few time with some variances, and each time the analysis result still contains the 'helper' and the 'debug' part.

What's wrong with my approach? Any tips will be appreciated.

Thanks.
--huafeng

Marc Hoffmann

unread,
Aug 8, 2019, 1:11:39 AM8/8/19
to jac...@googlegroups.com
Hi,

if you exclude the classes at runtime, this means no coverage data is collected for these classes. They will show as uncovered in the report.

To exclude the classes from the report, please specify the exclude when you create the report.

Regards,
-marc

--
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 jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/a8877c20-7abc-4c50-b879-d0552a4e15eb%40googlegroups.com.

lvhu...@gmail.com

unread,
Aug 28, 2019, 4:42:29 AM8/28/19
to JaCoCo and EclEmma Users
Hi Marc,
Will you please give me an example to show how to specify the exclude when you create the report? I searched around but haven't figure this out.
Thanks!
--huafeng


On Thursday, August 8, 2019 at 1:11:39 PM UTC+8, Marc R. Hoffmann wrote:
Hi,

if you exclude the classes at runtime, this means no coverage data is collected for these classes. They will show as uncovered in the report.

To exclude the classes from the report, please specify the exclude when you create the report.

Regards,
-marc
On 7. Aug 2019, at 05:52, lvhu...@gmail.com wrote:

hi guys,

I was using Jacoco to analyze my API interface tests. My class files have the following directories/packages:
com.X.Y.controller, com.X.Y.view, com.X.Y.view.model, com.X.Y.view.util, com.X.Y.util, com.X.Y.debug, com.X.Y.helper, etc. I wanted to use 'excludes=' to excludes the 'helper' and the 'debug' packages from the analysis scope, so in my java command line, I added this:
-javaagent:/path/to/lib/jacocoagent.jar=excludes=*.helper.*:*.debug.*,output=tcpserver,address=xxx,,port=xxx

I tried quite a few time with some variances, and each time the analysis result still contains the 'helper' and the 'debug' part.

What's wrong with my approach? Any tips will be appreciated.

Thanks.
--huafeng

--
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 jac...@googlegroups.com.

Marc Hoffmann

unread,
Aug 28, 2019, 4:48:35 AM8/28/19
to JaCoCo and EclEmma Users
Hi Huafeng,

what tool are you using to create the report?

Regards,
-marc





To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/4aa8ea0f-cd2d-4e2e-8268-45deda455b02%40googlegroups.com.

lvhu...@gmail.com

unread,
Aug 28, 2019, 4:58:04 AM8/28/19
to JaCoCo and EclEmma Users
I was using the ant command line tool with a build.xml configuration file. In build.xml, I defined dump, merge, report tasks.
Thanks Marc!
--huafeng

Evgeny Mandrikov

unread,
Aug 28, 2019, 5:06:30 AM8/28/19
to JaCoCo and EclEmma Users
Hi,

Ant tasks are described in documentation on page https://www.jacoco.org/jacoco/trunk/doc/ant.html ,
which contains description of how to define exclusions and inclusions for report task:

"Note that the classfiles and sourcefiles elements accept any Ant resource collection ( http://ant.apache.org/manual/Types/resources.html#collection ). Therefore also filtering the class file set is possible and allows to narrow the scope of the report, for example:"

<jacoco:report>
  <structure name="Example Project">  
    <classfiles>
      <fileset dir="classes">
        <include name="org/example/include/**/*.class"/>
        <exclude name="org/example/exclude/**/*.class"/>
      </fileset>
    </classfiles>

lvhu...@gmail.com

unread,
Aug 28, 2019, 5:46:51 AM8/28/19
to JaCoCo and EclEmma Users
This works! Thanks Evgeny!
--huafeng
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages