gradle jacocoTestReport不工作? [英] gradle jacocoTestReport is not working?

查看:1156
本文介绍了gradle jacocoTestReport不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在使用gradle jacoco插件的spring-gradle项目中获得代码覆盖率。



build.gradle包含以下内容:

  apply plugin: jacoco

jacoco {
toolVersion =0.7.1.201405082137
reportsDir = file($ buildDir / customJacocoReportDir)
}

jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination$ {buildDir} / jacocoHtml
}
}

然后我跑了

  gradle test jacocoTestReport 

在构建过程中仅生成文件test.exec / reports文件夹。



除此之外没有任何反应。



如何获取HTML报告?

div>

以下帮助。其在samples / testing / jacaco中的gradle-2.3-all.zip

  apply插件:java

apply plugin:jacoco

jacoco {
toolVersion =0.7.1.201405082137
reportsDir = file($ buildDir / customJacocoReportDir)
}

存储库{
mavenCentral()
}

依赖关系{
testCompilejunit:junit:4. +
}

test {
jacoco {
append = false
destinationFile = file($ buildDir / jacoco / jacocoTest.exec)
classDumpFile = file ($ buildDir / jacoco / classpathdumps)
}
}


jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination$ {buildDir} / jacocoHtml
}
}


I have tried to get code coverage in a spring-gradle project using gradle jacoco plugin.

The build.gradle contains the following

apply plugin: "jacoco"

    jacoco {
        toolVersion = "0.7.1.201405082137"
        reportsDir = file("$buildDir/customJacocoReportDir")
    }

    jacocoTestReport {
    reports {
        xml.enabled false
        csv.enabled false
        html.destination "${buildDir}/jacocoHtml"
    }
}

I then ran

gradle test jacocoTestReport

Where after only the file test.exec is generated in build/reports folder.

Other than that nothing happens.

How can I get the HTML report?

解决方案

Following helped . its in samples/testing/jacaco of gradle-2.3-all.zip

apply plugin: "java"

apply plugin: "jacoco"

jacoco {
    toolVersion = "0.7.1.201405082137"
    reportsDir = file("$buildDir/customJacocoReportDir")
}

repositories {
    mavenCentral()
}

dependencies {
    testCompile "junit:junit:4.+"
}

test {
    jacoco {
        append = false
        destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
        classDumpFile = file("$buildDir/jacoco/classpathdumps")
    }
}


jacocoTestReport {
    reports {
        xml.enabled false
        csv.enabled false
        html.destination "${buildDir}/jacocoHtml"
    }
}

这篇关于gradle jacocoTestReport不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆