单元测试结果未显示在SonarQube中

时间:2017-07-06 22:31:16

标签: maven jenkins sonarqube-scan

我配置了一个Jenkins构建来运行SonarQube,我看到了除代码覆盖之外的所有结果。我可以在surefire-reports目录中看到xml和txt文件,我也看到了jacoco.exec所以我很困惑我错过了什么,我怀疑这将是超级基本的东西。

SonarQube版本:6.3.1 詹金斯:2.46.2

这是我在Jenkins的SonarQube配置:

# metadata
sonar.projectName=${JOB_NAME}
sonar.projectVersion = 0.1

#path to source
sonar.projectBasedDir=${WORKSPACE}
sonar.sources=src/... (removed specific path)
sonar.binaries=target/classes


#report location
sonar.junit.reportPaths=${project.build.directory}/target/surefire-reports sonar.jacoco.reportPaths=${project.build.directory}/target/surefire-reports/jacoco.exec

#testing parms
sonar.verbose=true
sonar.tests=src/test/java
sonar.language=java

以下是我POM的插件数据:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.20</version>
    <configuration>
    <argLine>${argLine}</argLine>
    <runOrder>random</runOrder>
    </configuration>
</plugin>
<plugin>
    <groupId>org.jacoco</groupId> 
    <artifactId>jacoco-maven-plugin</artifactId> 
    <version>0.7.9</version> 
    <configuration>
         <destFile>${basedir}/target/surefire-reports/jacoco.exec</destFile>
         <dataFile>${basedir}/target/surefire-reports/jacoco.exec</dataFile>
    <output>file</output>
    <append>true</append>
    </configuration>
    <executions>
         <execution>
            <id>jacoco-initialize</id>
                <goals>
                    <goal>prepare-agent</goal>
                </goals>
         </execution>
         <execution>
            <id>report</id>
                <phase>prepare-package</phase>
                <goals>
                    <goal>report</goal>
                </goals>
          </execution>

         </executions>
        </plugin>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit47</artifactId>
            <version>2.20</version>
          </dependency>

1 个答案:

答案 0 :(得分:-1)

可能是报告路径参数应为:

brew install mysql

sonar.junit.reportsPath