我试图使用 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
}
}
最佳答案
您有一个拼写错误:使用
jacocoTestReport
而不是
jacoocoTestReport
(两个o)。
使用
gradle tasks
检查定义了哪些任务。
关于java - 在根项目中找不到任务 'jacoocoTestReport',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43007561/