2014-01-14 30 views
2

我想運行一個Maven構建在我的Eclipse環境中,我收到以下錯誤:jacoco:檢查失敗由於無效的參數

[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check (check) on project schedule-adapter: The parameters 'check' for goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check are missing or invalid -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check (check) on project schedule-adapter: The parameters 'check' for goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check are missing or invalid at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:221) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

我不明白,因爲這工作在我的其他項目一個不同的工作區。我複製了確切jacoco配置到我的新項目聚甲醛,並將其內容如下:

<pluginManagement> 
     <plugins> 
<plugin> 
      <groupId>org.jacoco</groupId> 
      <artifactId>jacoco-maven-plugin</artifactId> 
      <version>${jacoco.version}</version> 
      <executions> 
      <execution> 
       <id>prepare-agent</id> 
       <goals> 
       <goal>prepare-agent</goal> 
       </goals> 
      </execution> 
      <execution> 
       <id>report</id> 
       <phase>prepare-package</phase> 
       <goals> 
       <goal>report</goal> 
       </goals> 
      </execution> 
      <execution> 
       <id>check</id> 
       <goals> 
       <goal>check</goal> 
       </goals> 
       <configuration> 
       <haltOnFailure>true</haltOnFailure> 
       <rules> 
        <rule> 
        <limits> 
         <limit> 
         <counter>INSTRUCTION</counter> 
         <value>COVEREDRATIO</value> 
         <minimum>0.75</minimum> 
         </limit> 
         <limit> 
         <counter>CLASS</counter> 
         <value>COVEREDRATIO</value> 
         <minimum>0.75</minimum> 
         </limit> 
         <limit> 
         <counter>METHOD</counter> 
         <value>COVEREDRATIO</value> 
         <minimum>0.75</minimum> 
         </limit> 
         <limit> 
         <counter>BRANCH</counter> 
         <value>COVEREDRATIO</value> 
         <minimum>0.75</minimum> 
         </limit> 
         <limit> 
         <counter>COMPLEXITY</counter> 
         <value>COVEREDRATIO</value> 
         <minimum>0.75</minimum> 
         </limit> 
         <limit> 
         <counter>LINE</counter> 
         <value>COVEREDRATIO</value> 
         <minimum>0.75</minimum> 
         </limit> 
        </limits> 
        </rule> 
       </rules> 
       </configuration> 
      </execution> 
      </executions> 
     </plugin> 
</plugins> 
</pluginManagement> 

我的行家命令在Eclipse中運行是

mvn clean install -e 

任何站出來的人?我一直試圖弄清楚這一點。當我從我的pom中刪除所有這些,我的項目建立,但jacoco沒有被檢查。

感謝 瑞安

回答

2

發現了這個問題。 「規則」參數用於jacoco 0.6.3及更高版本。正如你可以看到我的錯誤,0.6.1被拉入。所以我添加了以下依賴項

+0

以下依賴項...? – planty182

+0

不幸的是,它已經很久了,我甚至不知道我的代碼在哪裏使用它!但基本上確保jacoco版本是0.6.3及以上:) – 75inchpianist

相關問題