Hi Marc, 1] Able to add jacocoagent.jar (which was packed inside org.jacoco.agent-0.7.7.201606060606.jar) to class path & things went fine for a single project. "jacoco.exec" was getting generated. But, when I ran for a multi-module maven project., jacoco.exec was NOT getting generated for all modules. Only one of the module have the report got generated ( though configured jacoco-agent.properties with destfile and added that as part of class path !!!) . Any idea why jacocoagent.jar in classpath not able to generate jacoco.exec for all modules ??
2] As jacoco.exec not getting generated for all modules while using jacocoagent.jar in classpath, *tried both classpath option as well as java agent option at same time*. In this case, I am able to see all jacoco.exec's got generated. Any harm using both classpath/javaagent option at same time ?? -Best Regards, Kesav. On Monday, October 17, 2016 at 5:14:28 PM UTC+5:30, Marc R. Hoffmann wrote: > > 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 working and 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] <javascript:>. > 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/0185e389-36dd-49f3-bfe6-f3bb247df4d7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
