Hi,
Thank you so much . I think I took a mistake like what you said
'This happens when you try to mix online instrumentation using Agent with
offline pre-instrumentation. Don't use both for the same classes.'
I am very new in jacoco ,ant and maven , and I've tried to use
<exclude> * </exclude> for "prepare-agent" and "report",but it doesn't
work. Maybe I shoud do it in org.jacoco.ant , but I still have no idea how
to exclude it. Here is my profile for jacoco, and it is defined in parent
pom.xml . "sub_moduleA" is one of the sub-modules .
Could you give me an sample to exclude a file and just modify the profile
,Thank you again !
<profile>
<id>jacoco</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>**/facebook/presto/**/Test*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<inherited>false</inherited>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>parent.basedir</name>
<value>${basedir}</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Copy the ant tasks jar. Needed for
ts.jacoco.report-ant . -->
<execution>
<id>jacoco-dependency-ant</id>
<goals>
<goal>copy</goal>
</goals>
<phase>process-test-resources</phase>
<inherited>false</inherited>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>0.7.7.201606060606</version>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
<outputDirectory>${basedir}/target/jacoco-jars</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>post-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Generating JaCoCo
Reports" />
<taskdef
classname="org.jacoco.ant.ReportTask" name="report">
<classpath
path="${parent.basedir}/target/jacoco-jars/org.jacoco.ant.jar" />
</taskdef>
<mkdir
dir="${parent.basedir}/target/site/jacoco" />
<report>
<executiondata>
<fileset
dir="${parent.basedir}/sub_moduleA/target">
<include name="jacoco.exec"
/>
</fileset>
<fileset
dir="${parent.basedir}/sub_moduleB/target">
<include name="jacoco.exec"
/>
</fileset>
...
</executiondata>
<structure name="jacoco-multi
Coverage Project">
<group name="jacoco-multi">
<sourcefiles
encoding="UTF-8">
<fileset
dir="${parent.basedir}/sub_moduleA/src/main/java" />
<fileset
dir="${parent.basedir}/sub_moduleB/src/main/java" />
...
</sourcefiles>
<classfiles>
<fileset
dir="${parent.basedir}/sub_moduleA/target/classes" >
<exclude
name="*.jar"/>
</fileset>
<fileset
dir="${parent.basedir}sub_moduleB/target/classes" >
<exclude
name="*.jar"/>
</fileset>
...
</classfiles>
</group>
</structure>
<csv
destfile="${parent.basedir}/target/site/jacoco/coverage-report.csv" />
<xml
destfile="${parent.basedir}/target/site/jacoco/coverage-report.xml" />
<html
destdir="${parent.basedir}/target/site/jacoco" />
</report>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>0.7.6.201602180812</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>
*.jar
</exclude>
<exclude>
**/BlockBuilderStatus.class
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
在 2017年1月7日星期六 UTC+8上午5:46:29,Evgeny Mandrikov写道:
>
> I want use BlockBuilderStatus.class without instrumentation
>
>
> Your initial question had no usage of
> http://www.jacoco.org/jacoco/trunk/doc/instrument-mojo.html , so I told
> you about exclusions for "prepare-agent" and "report".
> And "instrument" accepts file name for exclusions.
>
>
>> An Ant BuildException has occured: Error while creating report: Error
>> while analyzing xxx.class. Class xxx is already instrumented. "
>
>
> This happens when you try to mix online instrumentation using Agent with
> offline pre-instrumentation. Don't use both for the same classes.
>
> Please change your code to ignore synthetic members.
>>
>> where can I find a sample?
>
>
>
> https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Field.html#isSynthetic()
>
>
--
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/0bec6c3d-45f7-4b98-aaf8-aade45539819%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.