Running jacoco check goal with maven 3.5

38 views
Skip to first unread message

tuk

unread,
Aug 3, 2019, 12:47:32 PM8/3/19
to JaCoCo and EclEmma Users
My jacoco plugin configuration in a pom likes below

<plugin>
           
<groupId>org.jacoco</groupId>
           
<artifactId>jacoco-maven-plugin</artifactId>
           
<version>0.7.5.201505241946</version>
             
<executions>
               
<execution>
                 
<id>pre-unit-test</id>
                 
<goals>
                     
<goal>prepare-agent</goal>
                 
</goals>
                 
<configuration>
                   
<destFile>${jacoco.ut.execution.data.file}</destFile>
                 
</configuration>
               
</execution>
               
<execution>
                 
<id>merge-execs</id>
                 
<phase>pre-site</phase>
                 
<inherited>false</inherited>
                 
<goals>
                     
<goal>merge</goal>
                 
</goals>
                 
<configuration>
                   
<fileSets>
                     
<fileSet>
                       
<directory>${basedir}</directory>
                       
<includes>
                         
<include>**/target/*.exec</include>
                       
</includes>
                     
</fileSet>
                   
</fileSets>
                   
<destFile>${jacoco.ut.merged.exec}</destFile>
                 
</configuration>
               
</execution>
                 
<execution>
                     
<id>jacoco-check</id>
                     
<phase>verify</phase>
                     
<goals>
                         
<goal>check</goal>
                     
</goals>
                     
<configuration>
                         
<rules>
                             
<rule>
                                 
<element>BUNDLE</element>
                                 
<limits>
                                     
<limit>
                                         
<counter>LINE</counter>
                                         
<value>COVEREDRATIO</value>
                                         
<minimum>0.80</minimum>
                                     
</limit>
                                 
</limits>
                             
</rule>
                         
</rules>
                         
<dataFile>${jacoco.ut.merged.exec}</dataFile>
                     
</configuration>
                 
</execution>
             
</executions>
         
</plugin>

But when I am running mvn jacoco:check it is failing with the below error


[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.7.5.201505241946:check (default-cli) on project main: The parameters 'rules' for goal org.jacoco:jacoco-maven-plugin:0.7.5.201505241946:check are missing or invalid -> [Help 1]

Can someone let me know what is going wrong?



Evgeny Mandrikov

unread,
Aug 3, 2019, 4:53:06 PM8/3/19
to JaCoCo and EclEmma Users
Behavior that you observe is not specific to jacoco-maven-plugin , it is how Maven works - see https://maven.apache.org/guides/mini/guide-default-execution-ids.html

mvn jacoco:check

uses execution id "default-cli", while your pom.xml defines configuration in execution with id "jacoco-check" bound to phase "verify".

So either use this phase:

mvn verify

Or provide configuration outside of "executions" block (i.e. in "<plugin><configuration>") so that it will be inherited in all executions.

Or explicitly specify execution id  "jacoco-check":

mvn jacoco:check@jacoco-check

tuk

unread,
Aug 4, 2019, 5:09:05 AM8/4/19
to JaCoCo and EclEmma Users
Thanks it worked.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages