Hi,

ok, you could narrow down the instrumentation to your project by specifying

    includes="com.yourcompany.*"

But this is not the cause of the exception. There is another problem with your build script: You define a JaCoCo agent via JVM args and use the jacoco:coverage task. This will result in two JaCoCo agents configured for your tests and causes " Class
xy is already instrumented."

Please take a look at our documentation: http://www.eclemma.org/jacoco/trunk/doc/

It includes a working Ant example: http://www.eclemma.org/jacoco/trunk/doc/examples/build/build.xml

regards,
-marc

On 2015-06-18 16:03, [email protected] wrote:
Thanks Marc for the quick reply. Made the change as you suggested,
however it seems it's trying to instrument all files including TestNG
and Apache files. Throwing exception like, it's huge stack trace...
report:
[jacoco:coverage] Enhancing testng with coverage
   [testng] java.lang.instrument.IllegalClassFormatException: Error
while instrumenting class org/testng/TestNG.
   [testng]     at
org.jacoco.agent.rt.internal_13ff51f.CoverageTransformer.transform(CoverageTransformer.java:89)
   [testng]     at
sun.instrument.TransformerManager.transform(TransformerManager.java:181)
   [testng]     at
sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:377)
   [testng]     at java.lang.ClassLoader.defineClassImpl(Native Method)
   [testng]     at java.lang.ClassLoader.defineClass(ClassLoader.java:262)
   [testng]     at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
[testng] at java.net.URLClassLoader.defineClass(URLClassLoader.java:540) [testng] at java.net.URLClassLoader.defineClass(URLClassLoader.java:451) [testng] at java.net.URLClassLoader.access$300(URLClassLoader.java:79)
   [testng]     at
java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1038)
   [testng]     at
java.security.AccessController.doPrivileged(AccessController.java:314)
[testng] at java.net.URLClassLoader.findClass(URLClassLoader.java:429) [testng] at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:665)
   [testng]     at java.lang.ClassLoader.loadClass(ClassLoader.java:644)
[testng] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
   [testng]     at java.lang.ClassLoader.loadClass(ClassLoader.java:627)
   [testng] Caused by: java.io.IOException: Error while instrumenting
class org/testng/TestNG.
   [testng]     at
org.jacoco.agent.rt.internal_13ff51f.core.instr.Instrumenter.instrumentError(Instrumenter.java:152)
   [testng]     at
org.jacoco.agent.rt.internal_13ff51f.core.instr.Instrumenter.instrument(Instrumenter.java:103)
   [testng]     at
org.jacoco.agent.rt.internal_13ff51f.CoverageTransformer.transform(CoverageTransformer.java:87)
   [testng]     ... 15 more
   [testng] Caused by: java.lang.IllegalStateException: Class
org/testng/TestNG is already instrumented.

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

Reply via email to