使用Jacoco(带Gradle)执行的SonarQube失败

时间:2016-11-14 21:01:03

标签: gradle sonarqube sonarqube-scan

我正在尝试使用带有Gradle 3.1的SonarQube v5.2(带Jacoco)。 (org.sonarsource.scanner.gradle:sonarqube-gradle这个-插件:2.2)

之前由于相同的异常,我不得不切换到Sonar-runner(并且可以生成Sonar报告)但是为了让Jacoco工作,我不得不切换回SonarQube。 由于jar错误,它再次咬了我一下。 构建输出日志如下:

78472 tests completed, 337 failed, 11 skipped
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Invalid value of sonar.libraries for :component
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sonarqube'.
> No files nor directories matching '[/opt/application-data/bamboo-agent/gradle_repo/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar' in directory /opt/application-data/bamboo-agent/application-data-local/bamboo-agent/agent4/xml-data/build-dir/CV-SVPT-JOB1/component

多次尝试更改配置 但是无法让它发挥作用。

此组件的build.xml中的一些相关代码:

def jacocoExecutionData = "build/jacoco/testDebugUnitTest.exec"
def classesDirectory = "build";


task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest")      
{
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
    xml.enabled = true
    html.enabled = true
}
//fileTree(dir: "${project.buildDir}/classes/main", excludes: []

classDirectories = fileTree(dir: "${project.buildDir}/classes/main", excludes: [])

def coverageSourceDirs = ["${rootDir}/app/src/main/java"]
//additionalSourceDirs = files(coverageSourceDirs)

//classDirectories = fileTree(dir: classesDirectory)
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files(jacocoExecutionData)
}

sonarqube {
    properties {
        property "sonar.jacoco.reportPath", jacocoExecutionData
        }
    }

当我尝试从gradle-repo中删除jar时,不确定它是否是由jar冲突引起的(尽管Gradle再次下载了hamcrest-core-1.3.jar) 请求帮助。 非常感谢。

0 个答案:

没有答案