You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by James Green <ja...@gmail.com> on 2013/10/07 14:35:05 UTC

Jacoco:check - pom example?

Under build I have:

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${version.jacoco}</version>
                <executions>
                    <execution>
                        <id>prepare</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.15</minimum>
                                        </limit>
                                        <limit>
                                            <counter>CLASS</counter>
                                            <value>MISSEDCOUNT</value>
                                            <maximum>0</maximum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

The execution "verify" is the bit I've just added but my build blows up:

Caused by: java.lang.IllegalStateException: Class
org/powermock/modules/junit4/common/internal/impl/JUnit4TestSuiteChunkerImpl
is already instrumented.
at
org.jacoco.agent.rt.internal_9dd1198.core.internal.instr.InstrSupport.assertNotInstrumented(InstrSupport.java:81)
at
org.jacoco.agent.rt.internal_9dd1198.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:79)
at org.jacoco.agent.rt.internal_9dd1198.asm.ClassVisitor.visitField(Unknown
Source)
at org.jacoco.agent.rt.internal_9dd1198.asm.ClassReader.a(Unknown Source)
at org.jacoco.agent.rt.internal_9dd1198.asm.ClassReader.accept(Unknown
Source)
at org.jacoco.agent.rt.internal_9dd1198.asm.ClassReader.accept(Unknown
Source)
at
org.jacoco.agent.rt.internal_9dd1198.core.instr.Instrumenter.instrument(Instrumenter.java:78)
at
org.jacoco.agent.rt.internal_9dd1198.core.instr.Instrumenter.instrument(Instrumenter.java:96)
... 39 more
java.lang.instrument.IllegalClassFormatException: Error while instrumenting
class org/powermock/tests/utils/impl/AbstractTestSuiteChunkerImpl.
( etc )

I'm guessing that I've added the instruction the the pom incorrectly but
the documentation lacks an in-context example. Can anyone shed light on
this?

Thanks,
James

Re: Jacoco:check - pom example?

Posted by James Green <ja...@gmail.com>.
This works:

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${version.jacoco}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.15</minimum>
                                        </limit>
                                        <limit>
                                            <counter>CLASS</counter>
                                            <value>MISSEDCOUNT</value>
                                            <maximum>125</maximum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>



On 7 October 2013 14:11, James Green <ja...@gmail.com> wrote:

> According to the documentation they both/all bind to default phases and
> I'm in no position to disagree.
>
>
> On 7 October 2013 14:00, <th...@vkb.de> wrote:
>
>> Hi,
>>
>> > Under build I have:
>> >
>> >             <plugin>
>> >                 <groupId>org.jacoco</groupId>
>> >                 <artifactId>jacoco-maven-plugin</artifactId>
>> >                 <version>${version.jacoco}</version>
>> >                 <executions>
>> >                     <execution>
>> >                         <id>prepare</id>
>> >                         <goals>
>> >                             <goal>prepare-agent</goal>
>> >                         </goals>
>> >                     </execution>
>> >                     <execution>
>> >                         <id>verify</id>
>> >                         <configuration>
>> >                             <rules>
>> >                                 <rule>
>> >                                     <element>BUNDLE</element>
>> >                                     <limits>
>> >                                         <limit>
>> > <counter>INSTRUCTION</counter>
>> >                                             <value>COVEREDRATIO</value>
>> >                                             <minimum>0.15</minimum>
>> >                                         </limit>
>> >                                         <limit>
>> >                                             <counter>CLASS</counter>
>> >                                             <value>MISSEDCOUNT</value>
>> >                                             <maximum>0</maximum>
>> >                                         </limit>
>> >                                     </limits>
>> >                                 </rule>
>> >                             </rules>
>> >                         </configuration>
>> >                     </execution>
>> >                     <execution>
>> >                         <id>report</id>
>> >                         <phase>prepare-package</phase>
>> >                         <goals>
>> >                             <goal>report</goal>
>> >                         </goals>
>> >                     </execution>
>> >                 </executions>
>> >             </plugin>
>>
>> *snip*
>>
>> > I'm guessing that I've added the instruction the the pom incorrectly but
>> > the documentation lacks an in-context example. Can anyone shed light on
>> > this?
>>
>> Just a guess:
>> You didn't specify a phase for the executions with id "prepare" and
>> "verify"...?
>>
>>
>> Regards
>>
>> Thorsten
>
>
>

Re: Jacoco:check - pom example?

Posted by James Green <ja...@gmail.com>.
According to the documentation they both/all bind to default phases and I'm
in no position to disagree.


On 7 October 2013 14:00, <th...@vkb.de> wrote:

> Hi,
>
> > Under build I have:
> >
> >             <plugin>
> >                 <groupId>org.jacoco</groupId>
> >                 <artifactId>jacoco-maven-plugin</artifactId>
> >                 <version>${version.jacoco}</version>
> >                 <executions>
> >                     <execution>
> >                         <id>prepare</id>
> >                         <goals>
> >                             <goal>prepare-agent</goal>
> >                         </goals>
> >                     </execution>
> >                     <execution>
> >                         <id>verify</id>
> >                         <configuration>
> >                             <rules>
> >                                 <rule>
> >                                     <element>BUNDLE</element>
> >                                     <limits>
> >                                         <limit>
> > <counter>INSTRUCTION</counter>
> >                                             <value>COVEREDRATIO</value>
> >                                             <minimum>0.15</minimum>
> >                                         </limit>
> >                                         <limit>
> >                                             <counter>CLASS</counter>
> >                                             <value>MISSEDCOUNT</value>
> >                                             <maximum>0</maximum>
> >                                         </limit>
> >                                     </limits>
> >                                 </rule>
> >                             </rules>
> >                         </configuration>
> >                     </execution>
> >                     <execution>
> >                         <id>report</id>
> >                         <phase>prepare-package</phase>
> >                         <goals>
> >                             <goal>report</goal>
> >                         </goals>
> >                     </execution>
> >                 </executions>
> >             </plugin>
>
> *snip*
>
> > I'm guessing that I've added the instruction the the pom incorrectly but
> > the documentation lacks an in-context example. Can anyone shed light on
> > this?
>
> Just a guess:
> You didn't specify a phase for the executions with id "prepare" and
> "verify"...?
>
>
> Regards
>
> Thorsten

Re: Jacoco:check - pom example?

Posted by th...@vkb.de.
Hi,

> Under build I have:
> 
>             <plugin>
>                 <groupId>org.jacoco</groupId>
>                 <artifactId>jacoco-maven-plugin</artifactId>
>                 <version>${version.jacoco}</version>
>                 <executions>
>                     <execution>
>                         <id>prepare</id>
>                         <goals>
>                             <goal>prepare-agent</goal>
>                         </goals>
>                     </execution>
>                     <execution>
>                         <id>verify</id>
>                         <configuration>
>                             <rules>
>                                 <rule>
>                                     <element>BUNDLE</element>
>                                     <limits>
>                                         <limit>
> <counter>INSTRUCTION</counter>
>                                             <value>COVEREDRATIO</value>
>                                             <minimum>0.15</minimum>
>                                         </limit>
>                                         <limit>
>                                             <counter>CLASS</counter>
>                                             <value>MISSEDCOUNT</value>
>                                             <maximum>0</maximum>
>                                         </limit>
>                                     </limits>
>                                 </rule>
>                             </rules>
>                         </configuration>
>                     </execution>
>                     <execution>
>                         <id>report</id>
>                         <phase>prepare-package</phase>
>                         <goals>
>                             <goal>report</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>

*snip*

> I'm guessing that I've added the instruction the the pom incorrectly but
> the documentation lacks an in-context example. Can anyone shed light on
> this?

Just a guess:
You didn't specify a phase for the executions with id "prepare" and 
"verify"...?


Regards

Thorsten