Simple questions about JaCoCo design (agent.rt).

41 views
Skip to first unread message

Roberto Andrioli

unread,
Oct 13, 2016, 7:54:28 PM10/13/16
to JaCoCo and EclEmma Users
Hey guys,

I have a simple question about the JaCoCo design. I noticed that the *agent.rt* is deployed to Maven central as a classifier (runtime) from artifact *agent*. There is any reason for that? 

I'm guessing that this is due the fact that the *agent.rt* is built as a standalone JAR (with ASM included) and is not supplied wirh Javadoc and Sources (a requirement for Sonatype).

This is right? there is any other reason?

Regards

Roberto

Marc R. Hoffmann

unread,
Oct 14, 2016, 1:58:48 AM10/14/16
to jac...@googlegroups.com
Hi Roberto,

it is because the agent can be considered as a plain resource. It has no API. The module org.jacoco.agent provide an API to retrieve the agent as a resource.

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/8500294d-fd0d-4a66-ad0a-c56c37b8097a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roberto Andrioli

unread,
Nov 1, 2016, 12:24:56 PM11/1/16
to jac...@googlegroups.com

Hi Marc,

I understand. I come with this question for two reasons:

* I'm writing a tool using this "undocumented" agent runtime API. But there is no JavaDoc or Sources available at Maven central. But in fact, this is not a problem. The JavaDoc is available at JaCoCo's website and the API methods are self explanatory.
The tool I'm writing collect coverage per unit test, and I need to reset coverage after each test.

* I'm writing another tool, is a experimental Java agent for collect data flow coverage of Java bytecode. The code design is somehow inspired in JaCoCo's code. I was thinking if I should provide our  agent as a artifact classifier as in JaCoCo or as a common artifact.

Thanks


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/hxcCiXBhSas/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/d2440152-7da7-4918-f2d8-28ae990a3eb7%40mountainminds.com.

Evgeny Mandrikov

unread,
Nov 2, 2016, 7:27:35 AM11/2/16
to JaCoCo and EclEmma Users
Hi Roberto,

I would say that you should do what is better suitable for you and your project - either as main artifact, either as attached artifact with classifier :)

And I'm saying this, because:
As of today I would say that deployment of agent as attached artifact with classifier was not a very good decision. This decision was based on the fact that agent initially wasn't providing any APIs. And wasn't expected to be consumed directly, so we decided to hide it - hence classifier. Today I suppose that this creates more confusion than benefits - it provides some APIs and we receive questions about classifier. But we are not planning to change this in short term to not break things of others that rely on presence of attached artifact with classifier. So there are some historical reasons, which should not be used to justify design of new projects.

About agent APIs:
Package "org.jacoco.agent.rt.internal" is not an API and actually is renamed (on purpose) in each build, so final name varies from release to release and hence its content must not be used.
Package "com.vladium.emma.rt" is deprecated and hence should not be used.
Package "org.jacoco.agent.rt" is documented (http://www.eclemma.org/jacoco/trunk/doc/api/org/jacoco/agent/rt/package-summary.html), but you right that javadoc cannot be downloaded from Maven because of a story with classifier - one more cons of its usage.
MBean interface is documented.
Thus I doubt that you actually use "undocumented" agent API, but if so, then it is bad idea.

BTW an example of JUnit and TestNG listeners that reset coverage after each test can be found in https://github.com/SonarSource/sonar-java/tree/4.1/sonar-jacoco-listeners/src/main/java/org/sonar/java/jacoco , they are used to provide coverage per test in SonarQube ;)

Hope this helps.

Regards,
Evgeny

Roberto Andrioli

unread,
Nov 2, 2016, 11:11:06 AM11/2/16
to JaCoCo and EclEmma Users

Hi Evgeny,

Thank you.

I'm using Package "org.jacoco.agent.rt" and getting an instance of IAgent, the code is pretty similar to Sonar (actually I'm thinking if I should write a Sonar plugin instead).

Thanks again guys
Roberto


--
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/hxcCiXBhSas/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages