Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jacoco Gradle jacocoTestReport task failing Error while generating report - Is a directory

I'm using Gradle 1.6.

I run the following command and it works fine for all projects
gradle clean build jacocoTestReport

Today, I'm seeing that one of the project is failing during "jacocoTestReport" section. PS attached error log.

The main error lines are:

12:35:45.920 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: : Error while creating report
....
12:35:45.924 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.FileNotFoundException: /production/jenkinsAKS/workspace/MFUSvc/src/java-test/com/thc/ids/ws/mfu/msg/formulary (Is a directory)

Few points to note:

  1. This project was building finee without an error but today I'm seeing this error.
  2. I tried using two/different versions of jacoco (as shown below) - jacocoTestReport task works fine in all other projects using both versions, but fails for this one.

    jacoco {
    //toolVersion = "0.6.2.201302030002"
    toolVersion = "0.7.0.201403182114"
    // reportsDir = file("$buildDir/customJacocoReportDir")
    }

  3. Under the given src/java-test/.../... path, I see a valid .java file and in my workspace (once compileJava etc Gradle tasks are complete, I see build/classes/{main, test, integrationTest}/... folders contains a valid .class file (for that path which is showing up in the error and saying "Is a directory".

Any idea what I'm missing.

FULL (--stacktrace or --debug log) shows:

12:35:45.893 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on task artifact state cache (/production/jenkinsAKS/workspace/MFUSvc/.gradle/1.6/taskArtifacts).
12:35:45.893 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
12:35:45.894 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':jacocoTestReport'
12:35:45.894 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :jacocoTestReport FAILED
12:35:45.903 [ERROR] [org.gradle.BuildExceptionReporter]
12:35:45.903 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
12:35:45.903 [ERROR] [org.gradle.BuildExceptionReporter]
12:35:45.903 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
12:35:45.904 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':jacocoTestReport'.
12:35:45.904 [ERROR] [org.gradle.BuildExceptionReporter] > Error while creating report
12:35:45.905 [ERROR] [org.gradle.BuildExceptionReporter]
12:35:45.905 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
12:35:45.906 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jacocoTestReport'.
12:35:45.906 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
12:35:45.906 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
12:35:45.907 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
12:35:45.907 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter$1.run(CacheLockReleasingTaskExecuter.java:35)
12:35:45.907 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.Factories$1.create(Factories.java:22)
12:35:45.907 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
12:35:45.908 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
12:35:45.908 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
12:35:45.908 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
12:35:45.908 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter.execute(CacheLockReleasingTaskExecuter.java:33)
12:35:45.908 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:58)
12:35:45.909 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.ContextualisingTaskExecuter.execute(ContextualisingTaskExecuter.java:34)
12:35:45.909 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter$1.run(CacheLockAcquiringTaskExecuter.java:39)
12:35:45.909 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.Factories$1.create(Factories.java:22)
12:35:45.909 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
12:35:45.910 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
12:35:45.910 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
12:35:45.910 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
12:35:45.910 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter.execute(CacheLockAcquiringTaskExecuter.java:37)
12:35:45.910 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
12:35:45.911 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
12:35:45.911 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
12:35:45.911 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
12:35:45.911 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
12:35:45.911 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:282)
12:35:45.912 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:48)
12:35:45.912 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:34)
12:35:45.912 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:27)
12:35:45.912 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:89)
12:35:45.912 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
12:35:45.913 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
12:35:45.913 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
12:35:45.913 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
12:35:45.913 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
12:35:45.913 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.Factories$1.create(Factories.java:22)
12:35:45.914 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
12:35:45.914 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
12:35:45.914 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
12:35:45.914 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
12:35:45.914 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
12:35:45.915 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
12:35:45.915 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
12:35:45.915 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
12:35:45.915 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
12:35:45.915 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
12:35:45.916 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
12:35:45.916 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
12:35:45.916 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
12:35:45.916 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
12:35:45.916 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
12:35:45.917 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
12:35:45.917 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
12:35:45.917 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
12:35:45.917 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
12:35:45.917 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
12:35:45.918 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
12:35:45.918 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
12:35:45.918 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
12:35:45.918 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
12:35:45.918 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
12:35:45.919 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
12:35:45.919 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
12:35:45.919 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.Main.doAction(Main.java:48)
12:35:45.919 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
12:35:45.919 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.Main.main(Main.java:39)
12:35:45.920 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
12:35:45.920 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
12:35:45.920 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
12:35:45.920 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: : Error while creating report
12:35:45.920 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.ant.ReportTask.execute(ReportTask.java:500)
12:35:45.920 [ERROR] [org.gradle.BuildExceptionReporter]        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
12:35:45.921 [ERROR] [org.gradle.BuildExceptionReporter]        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
12:35:45.921 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)
12:35:45.921 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:86)
12:35:45.921 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.DefaultAntBuilder.super$3$invokeMethod(DefaultAntBuilder.groovy)
12:35:45.921 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.DefaultAntBuilder.invokeMethod(DefaultAntBuilder.groovy:37)
12:35:45.922 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.testing.jacoco.tasks.JacocoReport.generate(JacocoReport.groovy:77)
12:35:45.922 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
12:35:45.922 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
12:35:45.922 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
12:35:45.922 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.testing.jacoco.tasks.JacocoReport_Decorated.invokeMethod(Unknown Source)
12:35:45.923 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
12:35:45.923 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)
12:35:45.923 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
12:35:45.923 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)
12:35:45.923 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:526)
12:35:45.924 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:509)
12:35:45.924 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
12:35:45.924 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
12:35:45.924 [ERROR] [org.gradle.BuildExceptionReporter]        ... 67 more
12:35:45.924 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.FileNotFoundException: /production/jenkinsAKS/workspace/MFUSvc/src/java-test/com/thc/ids/ws/mfu/msg/formulary (Is a directory)
12:35:45.925 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.DirectorySourceFileLocator.getSourceStream(DirectorySourceFileLocator.java:50)
12:35:45.925 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.InputStreamSourceFileLocator.getSourceFile(InputStreamSourceFileLocator.java:49)
12:35:45.925 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.MultiSourceFileLocator.getSourceFile(MultiSourceFileLocator.java:56)
12:35:45.925 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.internal.html.page.PackageSourcePage.renderSourceFilePages(PackageSourcePage.java:83)
12:35:45.925 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.internal.html.page.PackageSourcePage.render(PackageSourcePage.java:66)
12:35:45.926 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.internal.html.page.PackagePage.render(PackagePage.java:60)
12:35:45.926 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.internal.html.page.BundlePage.renderPackages(BundlePage.java:70)
12:35:45.926 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.internal.html.page.BundlePage.render(BundlePage.java:57)
12:35:45.926 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.html.HTMLFormatter$1.visitBundle(HTMLFormatter.java:212)
12:35:45.926 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.report.MultiGroupVisitor.visitBundle(MultiReportVisitor.java:69)
12:35:45.927 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.ant.ReportTask.createReport(ReportTask.java:555)
12:35:45.927 [ERROR] [org.gradle.BuildExceptionReporter]        at org.jacoco.ant.ReportTask.execute(ReportTask.java:494)
12:35:45.927 [ERROR] [org.gradle.BuildExceptionReporter]        ... 86 more
12:35:45.927 [ERROR] [org.gradle.BuildExceptionReporter]
12:35:45.927 [LIFECYCLE] [org.gradle.BuildResultLogger]
12:35:45.927 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
12:35:45.927 [LIFECYCLE] [org.gradle.BuildResultLogger]
12:35:45.928 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 15.283 secs

and Now it's coming for some path under src/java (instead of src/java-test).

Caused by: : Error while creating report
 at org.jacoco.ant.ReportTask.execute(ReportTask.java:500)
 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)
 at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:86)
 at org.gradle.api.internal.project.DefaultAntBuilder.super$3$invokeMethod(DefaultAntBuilder.groovy)
 at org.gradle.api.internal.project.DefaultAntBuilder.invokeMethod(DefaultAntBuilder.groovy:37)
 at org.gradle.testing.jacoco.tasks.JacocoReport.generate(JacocoReport.groovy:77)
 at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
 at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
 at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
 at org.gradle.testing.jacoco.tasks.JacocoReport_Decorated.invokeMethod(Unknown Source)
 at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
 at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)
 at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
 at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)
 at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:526)
 at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:509)
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
 ... 67 more
Caused by: java.io.FileNotFoundException: /production/jenkinsAKS/workspace/MFUSvc/src/java/com/thc/ids/biz/mfusvc/dto (Is a directory)
 at org.jacoco.report.DirectorySourceFileLocator.getSourceStream(DirectorySourceFileLocator.java:50)
 at org.jacoco.report.InputStreamSourceFileLocator.getSourceFile(InputStreamSourceFileLocator.java:49)
 at org.jacoco.report.MultiSourceFileLocator.getSourceFile(MultiSourceFileLocator.java:56)
 at org.jacoco.report.internal.html.page.PackageSourcePage.renderSourceFilePages(PackageSourcePage.java:83)
 at org.jacoco.report.internal.html.page.PackageSourcePage.render(PackageSourcePage.java:66)
 at org.jacoco.report.internal.html.page.PackagePage.render(PackagePage.java:60)
 at org.jacoco.report.internal.html.page.BundlePage.renderPackages(BundlePage.java:70)
 at org.jacoco.report.internal.html.page.BundlePage.render(BundlePage.java:57)
 at org.jacoco.report.html.HTMLFormatter$1.visitBundle(HTMLFormatter.java:212)
 at org.jacoco.report.MultiGroupVisitor.visitBundle(MultiReportVisitor.java:69)
 at org.jacoco.ant.ReportTask.createReport(ReportTask.java:555)
 at org.jacoco.ant.ReportTask.execute(ReportTask.java:494)
 ... 86 more

This is what I have for jacocoTestReport task in /init.d/common.gradle file:

  jacocoTestReport {
      group = "Reporting"
      description = "Generate Jacoco coverage reports after running tests."
      ignoreFailures = true
      executionData = fileTree(dir: 'build/jacoco', include: '**/*.exec')

      reports {
             xml{
                 enabled true
                 //Following value is a file
                 destination "${buildDir}/reports/jacoco/xml/jacoco.xml"
             }
             csv.enabled false
             html{
                 enabled true
                 //Following value is a folder
                 destination "${buildDir}/reports/jacoco/html"
             }
      }

      sourceDirectories = files('src/java')
      classDirectories =  files('build/classes/main')
}
like image 230
AKS Avatar asked Apr 04 '14 16:04

AKS


People also ask

What is jacocoTestReport?

JaCoCo Report configurationThe JacocoReport task can be used to generate code coverage reports in different formats. It implements the standard Gradle type Reporting and exposes a report container of type JacocoReportsContainer. Example 4. Configuring test task. build.gradle.


1 Answers

Update: I know why! -- sourceSet { ... } section for main/java, test/java, etc.. has a 'not_valid_value' for srcDir setting for each main, test, etc section --> in my global init.d level "common.gradle" file and it's applied to allprojects {...}. I have mentioned global sourceSet section in global common.gradle file so that I dont have to include common tasks/configurations for test, integrationTest etc tasks in each project's build.gradle file. Now, because srcDir for each of them is set to 'not_valid_value' at global level, my assumption is, this invalid srcDir value will be either overwritten by the actual valid srcDir value (when Gradle build system will read sourceSets section {...} from each individual project's build.gradle file's sourceSet section for main, test, etc OR they will be clubbed together as a list entry i.e. main srcDir will become ['src/java', 'not_valid_value'] --- which when I printed in common.gradle and ran project gradle build, printed valid clubbed value:

  println ""
  println "sourceSets.main.allJava.srcDirs is set to : " + sourceSets.main.allJava.srcDirs
  println ""

value printed, don't know if ' quotes will be required as Gradle printed it fine:

sourceSets.main.allJava.srcDirs is set to : [/production/jenkinsAKS/workspace/MFUSvc/src/main/java, /production/jenkinsAKS/workspace/MFUSvc/not_valid_value]

Thus, when I'm using, sourceSets.main.allJava.srcDirs for sourceDirectories variable in jacocoTestReport task, its passing and not giving me an error (as I have mentioned in my post) even though, srcDir variable for main/java is: ['src/java', 'not_valid_value'] at BUILD TIME i.e. one from common.gradle and one from project's build.gradle sourceSet section. I don't get the error NOW, BUT it's now breaking the HTML links in generated reports aka index.html... see below snapshot image.

When I use the actual value for main/java, test/java (i.e. srcDir 'src/java' or srcDir 'test/java' or srcDir 'src/java-test') in "common.gradle" global file, inside sourceSet section --OR if I hard code sourceDirectories variable of jacocoTestReport task ---- it's giving me the same error that I have mentioned in the post BUT for other projects, its successful and I see HTML links are working in jacoco HTML report index.html. Wherever it's successful in this case, I found that I had valid source code java file under test/java or src/java-test tree. The project which is failing and giving me an error doesn't have anything under test/java, src/java-test tree thus, during the build, build/jacoco folder is not generated as no tests are there for the project which is failing. So, it still remains, why "src/java" or "src/java-test" is failing jacocoTestReport task for this particular project.

If I use the following inplace of defining actual value src/java

sourceDirectories = files(sourceSets.main.allJava.srcDirs)

for JacocoTestReport task, it works for showing the coverage % info correctly and the error messages shown in my post above are NOT showing up now (may be srcDir is not valid value -- but I printed the value of sourceSets.main.allJava.srcDirs and it shows ['src/java', 'not_valid_value'] at build time), but it breaks the HTML links to the source file i.e. when you browse jacoco HTML report Element column, you can see coverage percentage but at the deep end, when you click at the function/class level, you can't see the source code of the file (where you can see Green/Yellow/Red coverage by line).

If I'm using "src/java" in sourceSets { .. main { java { srcDir 'src/java' } } } OR for sourceDirectories = files('src,java') in jacocoTestReport task ---> then I'm getting the following error:

Caused by: java.io.FileNotFoundException: /production/jenkinsAKS/workspace/MFUSvc/src/java/com/thc/ids/biz/mfusvc/dto (Is a directory)

I see the other similar error message with path "src/java-test" in it as the source control does have src/java-test containing tests.

  //The following works for showing coverage %, but can't see file content at func/class level in HTML report
  sourceDirectories = files(sourceSets.main.allJava.srcDirs)

  // Enabling/uncommenting The following line for sourceDirectories - shows both coverage % and at the deep level if you click func/class Element link in jacoco HTML report, you'll see file content with colored coverage per line BUT, it gives error in few projects not in all (as for some, jacocoTestReport is successful)
  //sourceDirectories = files('src/java')


  //classDirectories =  files('build/classes/main')


  //------------------------------------------
  // If I play with uncommenting the following, I see that jacocoTestReport task generating (is a directory) error message either for src/java-test or test/java -- in some projects.. NOTE: not in all projects.
  //additionalSourceDirs = files('test/java')
  //additionalSourceDirs += files('src/java-test')

  //additionalClassDirs = files('build/classes/test')
  //additionalClassDirs += files('build/classes/integrationTest')
  //additionalClassDirs += files('build/classes/acceptanceTest')
  //------------------------------------------


ATLEAST, one thing is clear for which I was looking for some time now. "Element" column link for function or class level is working when I'm giving hard coded value. Somehow it's not picking (sourceSets.main.allJava.srcDirs) or (sourceSets.main.java.srcDirs) which is what I saw in some blogs.

enter image description here

like image 157
AKS Avatar answered Nov 11 '22 20:11

AKS