无法获得Cobertura报道

时间:2015-01-13 16:10:52

标签: maven sonarqube cobertura

我在Eclipse项目中使用SonarQube 4.5.2和Maven。这是来自我的POM的片段:

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>${cobertura.maven.plugin.version}</version>
        <configuration>
          <instrumentation>
            <ignores>
              <ignore>org.xxx.xxx.gwt.xxx.common.client.ui.overlay.xxx.gen.*</ignore>
            </ignores>
            <excludes>
              <exclude>org/xxx/xxx/gwt/xxx/common/client/ui/overlay/xxx/gen/**/*.class</exclude>
              <exclude>org/xxx/xxx/gwt/xxx/common/client/ui/overlay/xxx/gen/**/*Test.class</exclude>
            </excludes>
          </instrumentation>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>clean</goal>
              <goal>cobertura</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.13</version>
        <configuration>
          <argLine>-Xmx512M -XX:MaxPermSize=128M</argLine>
        </configuration>
      </plugin>

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>${gwtplugin.version}</version>
        <configuration>
          <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
          <extraJvmArgs>-Xss2M -XX:MaxPermSize=512M -Xmx2048m -Xdebug </extraJvmArgs>
          <!-- <extraJvmArgs>-Xss2M -XX:MaxPermSize=400M -Xms700M -Xmx1024M</extraJvmArgs> -->
          <hostedWebapp>web</hostedWebapp>
          <modules>
            <module>org.xxx.xxx.gwt.xxx.xxx.Module1</module>
            <module>org.xxx.xxx.gwt.xxx.xxx.Module2</module>
            <module>org.xxx.xx.gwt.xxx.xxx.Module3</module>
          </modules>
          <compileReport>true</compileReport>
          <strict>true</strict>
          <runTarget>app.html</runTarget>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt.version}</version>
          </dependency>
          <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwt.version}</version>
          </dependency>
        </dependencies>
      </plugin>

<profile>
        <id>sonar</id>
        <properties>
            <!-- SonarQube enables the appropriate plugin from the coverage report that already finds -->
            <!-- <sonar.java.coveragePlugin>cobertura</sonar.java.coveragePlugin> -->
            <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
            <!-- <sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath> -->
            <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>
            <sonar.jdbc.username>username</sonar.jdbc.username>
            <sonar.jdbc.password>password</sonar.jdbc.password>
            <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
            <sonar.host.url>http://localhost:9000/</sonar.host.url>
            <sonar.projectVersion>2.0</sonar.projectVersion>
            <sonar.language>java</sonar.language>
            <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
            <sonar.sources>src/main/java</sonar.sources>
            <sonar.inclusions>(...)</sonar.inclusions>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.18.1</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.sonar</groupId>
                    <artifactId>sonar-maven3-plugin</artifactId>
                    <version>4.5.2</version>
                </plugin>
            </plugins>
       </build>
    </profile>

现在当我运行 mvn clean -Psonar test cobertura:cobertura sonar:sonar 时,我希望访问http://localhost:9000/并检查代码覆盖小部件。但它显示0%。有谁知道为什么会这样?

Java版本1.6.0_45。 Eclipse Luna。 SonarQube 4.5.2。

0 个答案:

没有答案