我试图通过使用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
}
}
答案 0 :(得分:1)
您运行的任务无效(双 o ):
gradle test jacoocoTestReport
而不是:
gradle test jacocoTestReport
答案 1 :(得分:1)
你有一个错字:使用
jacocoTestReport
而不是
jacoocoTestReport
(两个o)。
使用
gradle tasks
检查定义了哪些任务。