MAVEN3:如何在子项目中禁用emma-maven-plugin

时间:2016-01-13 22:38:07

标签: java maven maven-3 emma

我有一个父pom.xml,它定义了带有inherited = true的emma-maven-plugin。

<reporting>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>${maven.site.version}</version>
         </plugin>
         <plugin>
            <groupId>org.sonatype.maven.plugin</groupId>
            <artifactId>emma-maven-plugin</artifactId>
            <version>${emma.maven.version}</version>
            <inherited>true</inherited>
         </plugin>
</plugins>
</reporting>

但是我有一个不包含任何测试的子pom.xml。所以我尝试添加这个...执行无,继承false并跳过true跳过emma报告生成,但它似乎不起作用。有什么想法吗?

<build>
  <plugins>
    <plugin>
      <groupId>org.sonatype.maven.plugin</groupId>
      <artifactId>emma-maven-plugin</artifactId>
      <version>${emma.maven.version}</version>            
      <inherited>false</inherited>
      <executions>
        <execution>
          <phase>none</phase>
        </execution>
      </executions>
      <configuration>               
        <skip>true</skip>
      </configuration>
    </plugin>
  </plugins>
</build>

<reporting>
  <plugins>
    <plugin>
      <groupId>org.sonatype.maven.plugin</groupId>
      <artifactId>emma-maven-plugin</artifactId>
      <version>${emma.maven.version}</version>            
      <inherited>false</inherited>
      <configuration>               
        <skip>true</skip>
      </configuration>
    </plugin>
  </plugins>
</reporting>

1 个答案:

答案 0 :(得分:0)

我找到了一种不对特定包进行检测的方法,因此没有创建coverage。因此没有创建EMMA报告。

<build>
  <plugins>
  <plugin>
    <groupId>org.sonatype.maven.plugin</groupId>
    <artifactId>emma-maven-plugin</artifactId>
    <version>${emma.maven.version}</version>            
    <configuration>
      <filters>
        <filter>-com.package.*</filter>
      </filters>
    </configuration>
  </plugin>
  </plugins>
   </build>