【发布时间】:2017-08-17 20:49:29
【问题描述】:
我正在尝试使用 gradle 和 jacoco 在我的 java 程序中找出 JUnit 测试的行覆盖率,但以下命令会导致失败。
gradle test jacoocoTestReport
命令打印:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'jacoocoTestReport' not found in root project 'ProjectName'. Some candidates are: 'jacocoTestReport'.
* Try:
Run gradle tasks to get a list of available tasks. Run with
--stacktrace option to get the stack trace. Run with
--info
or
--debug
option to get more log output.
BUILD FAILED
Total time: 3.389 secs
我的 gradle 项目的 build.gradle:
apply plugin: "jacoco"
apply plugin: 'java'
apply plugin: 'application'
repositories {
jcenter()
}
dependencies {
compile 'com.google.guava:guava:20.0'
testCompile 'junit:junit:4.12'
}
mainClassName = 'example.Main'
run {
standardInput = System.in
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
【问题讨论】: