试图让Sonar CXX插件正常工作

时间:2012-02-15 19:32:13

标签: jenkins sonarqube

设置Jenkins(带声纳插件)和声纳(带cxx插件)。有一个构建步骤来创建“....... / gcovr-reports / gcovr-result-test.xml”文件。问题是覆盖结果未显示ob Snar仪表板。但似乎sonar.runner正在激动......但是成绩单并没有表明CxxGcovrSensor正在运行。

1 个答案:

答案 0 :(得分:0)

你得到什么错误消息? 尝试使用maven导入项目,以获取有关errormessges的更多详细信息。

我有类似的问题因为我的pom.xml坏了。下面是一个工作的。 确保您的文件夹结构如下所示:

(你需要cd到基地)

base = / some / folder / myProject /< - 把pom.xml放在这里

SRC_FOLDER = /一些/文件夹/ myProject的/ SRC

reports_folder = / some / folder / myProject / reports(包含报告的所有子目录)

还要确保您的报告名为lik:xunit-result-.xml

cd to / some / folder / myProject和mvn sonar:sonar  (mvn -X声纳:调试模式的声纳)

(顺便说一句。如果你遇到奇怪的错误,请尝试从声纳/外部/插件中删除所有不相关的插件(只需将cxx留在那里)

不要忘记为声纳设置JAVA_PATH 转到底部文件夹

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>NETICOA</groupId>
  <artifactId>MYPROJECT</artifactId>
  <version>5.3.10-myversion</version>
  <packaging>pom</packaging>
  <name>myProject</name>

  <description>php svn code</description>

  <!-- pom.xml extract -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cxx-maven-plugin</artifactId>
        <version>0.0.5-SNAPSHOT</version>
        <configuration>
          <sourceDirs>
            <sourceDir>${basedir}/src</sourceDir>
          </sourceDirs>
          <!-- All of the sub configuration nodes following are needed by sonar-cxx plugin -->
          <!-- This sample provided values are default values. -->
          <!-- So you can simple remove all of it if you provide reports in the right places -->
          <xunit>
            <directory>${basedir}/reports/xunit-reports</directory>
            <includes>
              <include>**/xunit-result-*.xml</include>
            </includes>
          </xunit>
          <gcovr>
            <directory>${basedir}/reports/gcovr-reports</directory>
            <includes>
              <include>**/gcovr-reports-*.xml</include>
            </includes>
          </gcovr>
          <cppcheck>
            <directory>${basedir}/reports/cppcheck-reports</directory>
            <includes>
              <include>**/cppcheck-result-*.xml</include>
            </includes>
            <reportsIncludeSourcePath>
              <include>..</include>
            </reportsIncludeSourcePath>
          </cppcheck>
          <cppncss>
            <directory>${basedir}/reports/cppncss-reports</directory>
            <includes>
              <include>**/cppncss-result-*.xml</include>
            </includes>
            <reportsIncludeSourcePath>
              <include>..</include>
            </reportsIncludeSourcePath>
          </cppncss>
          <veraxx>
            <directory>${basedir}/reports/vera++-reports</directory>
            <includes>
              <include>**/vera++-result-*.xml</include>
            </includes>
            <reportsIncludeSourcePath>
              <include>..</include>
            </reportsIncludeSourcePath>
          </veraxx>
          <valgrind>
            <directory>${basedir}/reports/valgrind-reports</directory>
            <includes>
              <include>**/valgrind-result-*.xml</include>
            </includes>
            <reportsIncludeSourcePath>
              <include>..</include>
            </reportsIncludeSourcePath>
          </valgrind>
        </configuration>
      </plugin>
    </plugins>  
    <!-- We have our own <configuration><sourceDirs> node inside cxx plugin configuration -->
    <!-- <sourceDirectory>${basedir}/sources</sourceDirectory> -->
  </build>
  <properties>
    <sonar.language>c++</sonar.language>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
  </properties>
</project>