inet
inet

Reputation: 31

Task 'jacoocoTestReport' not found in root project

I'm trying to find out the line coverage of the JUnit tests in my java program by using gradle and jacoco but the following command causes a failure.

gradle test jacoocoTestReport

The command prints:

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

The build.gradle of my gradle project:

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
   }
}

Upvotes: 2

Views: 14829

Answers (2)

Robert
Robert

Reputation: 8693

You have a typo: use

jacocoTestReport

instead of

jacoocoTestReport

(two o's).

Use

gradle tasks

to check what tasks are defined.

Upvotes: 2

Opal
Opal

Reputation: 84884

You've run an invalid task (double o):

gradle test jacoocoTestReport

instead of:

gradle test jacocoTestReport

Upvotes: 1

Related Questions