Thanks @marc for your information. I'm trying to use the jacoco 
offline instrumentation with the following configuration:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.5.201505241946</version>
    <executions>
        <execution>
            <id>default-instrument</id>
            <goals>
                <goal>instrument</goal>
            </goals>
        </execution>
        <execution>
            <id>default-restore-instrumented-classes</id>
            <goals>
                <goal>restore-instrumented-classes</goal>
            </goals>
        </execution>
        <execution>
            <id>default-report</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>report</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.12.2</version>
    <configuration>
        <systemPropertyVariables>
            <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
        </systemPropertyVariables>
    </configuration>
</plugin>


and also with dependency:


<dependency>
    <groupId>org.jacoco</groupId>
    <artifactId>org.jacoco.agent</artifactId>
    <classifier>runtime</classifier>
    <version>0.7.5.201505241946</version>
</dependency>


but all tests failed due to org/jacoco/agent/rt/internal_b0d6a23/Offline 
can not be found. Is there anything wrong with my configration?

On Friday, August 14, 2015 at 4:04:56 PM UTC+8, Marc R. Hoffmann wrote:
>
> Hi, 
>
> JaCoCo works on class files only. It reports whatever it sees in the 
> class files which get instrumented and analyzed. Future versions might 
> come with the option to filter certain constructs, but for AspectJ this 
> will probably not work as you can inject any code. 
>
> To solve this you have to make sure that the class files get instrumeted 
> by JaCoCo *before* AspectJ kicks in. If you use the AspectJ agent it has 
> to be configured after the JaCoCo agent. If you want to pre-compile your 
> classes you can use JaCoCo offline instrumentation first: 
> http://www.eclemma.org/jacoco/trunk/doc/offline.html 
>
> Regards, 
> -marc 
>
>
> On 2015-08-14 07:16, zhz shi wrote: 
> > Hi, 
> > 
> > We're using AspectJ in our project and also Jacoco for test coverage 
> > report, currently we're facing an issue that due to AspectJ changed 
> > the byte code during compiling phase, which makes the code coverage 
> > report not correct. One example is due to AspectJ adds extra if-else 
> > statement, then the branch coverage shows something like 1/4 but 
> > actually there's no condition branch in the source code. Is there some 
> > good way to tell Jacoco to ignore all code generated by AspectJ? 
> > 
> > I also created an issues 335 [1] on Github and posted an question on 
> > SO [2]. 
> > 
> > Thanks a lot. 
> > 
> >  -- 
> > 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/e96a08b4-8c44-469a-b32b-52f013e57bbd%40googlegroups.com
>  
> > [3]. 
> > For more options, visit https://groups.google.com/d/optout [4]. 
> > 
> > 
> > Links: 
> > ------ 
> > [1] https://github.com/jacoco/jacoco/issues/335 
> > [2] 
> > 
> http://stackoverflow.com/questions/32001843/jacoco-code-coverage-is-affected-by-aspectj
>  
> > [3] 
> > 
> https://groups.google.com/d/msgid/jacoco/e96a08b4-8c44-469a-b32b-52f013e57bbd%40googlegroups.com?utm_medium=email&utm_source=footer
>  
> > [4] 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/088f94d1-850a-4c7b-a420-ef39147daf80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to