Hi,
the JaCoCo runtime needs to be accessible to by the executed classes.
One option is to put it on the application classpath, another option is
to configure the the JaCoC agent (all Java agents are added to classpath).
Typical pitfalls with offline instrumentations to check for:
1) The JaCoCo runtime must be the exact same version than the JaCoCo
instrumentation tool.
2) The JaCoCo runtime classes must be visible to the classes under test
from a classloading perspective. This is typically only the case for
simple "main" applications. As soon as you run in containers (J2EE, OSGi
etc.) the application classpath might not be visible to deployed components.
Regards,
-marc
On 17.10.16 09:55, yajvane wrote:
Hi,
As per the documentation available
at http://www.eclemma.org/jacoco/trunk/doc/offline.html on "Using
Pre-Instrumented Classes With the Java Agent' :
"*It is possible*to also use offline-instrumented classes with the
JaCoCo Java agent. In this case the configuration is taken from the
agent options. The agent must be configured in a way that
pre-instrumented classes are excluded, e.g. with "|excludes=*|".
Otherwise it will result in error messages on the console if the agent
instruments such classes again."
I tried with couple of maven projects and able to see that this
(pre-instrumented classes with jacoco-maven-plugin:prepare-agent test)
is working fine. But, in some projects this is NOT workingand throwing
an exception "Caused by: java.lang.ClassNotFoundException:
org.jacoco.agent.rt.internal_6da5971.Offline" (I was following on this
exception on separate thread).
Please help me in understanding this ! In what scenarios it works and
not works !!! Would request to please elaborate on the phrase *"It is
possible..."*
I understand that offline instrumentation + placing jacocoagent.jar
in class-path is the right way, but some how ., with whatever the
possible maven (pom.xml) configuration ., that's always throwing
exception. That's why trying to understand the things at more deeper
level !!!
Thank you !!!
-Regards,
Kesav.
--
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/f85f8ef7-dbf6-4950-95d2-6d382e0995c6%40googlegroups.com
<https://groups.google.com/d/msgid/jacoco/f85f8ef7-dbf6-4950-95d2-6d382e0995c6%40googlegroups.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/433812aa-481c-99ec-914c-d97c84448aac%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.