Java 任务';jacoocoTestReport&x27;在根项目中找不到

Java 任务';jacoocoTestReport&x27;在根项目中找不到,java,gradle,junit,jacoco,Java,Gradle,Junit,Jacoco,我试图通过使用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: 'jacocoT

我试图通过使用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
   }
}

您运行的任务无效(双o):

而不是:

gradle test jacocoTestReport
你有一个输入错误:使用

jacocoTestReport

而不是

jacoocoTestReport

(两个o)

使用

梯度任务


检查定义了哪些任务。

当我使用
gradlew test jacocoTestReport
gradle test jacocoTestReport