Estoy tratando de generar un informe jacoco XML a partir de generar archivos exec, pero ant arroja un error que indica que no puede encontrar un archivo xml dentro del jacocoant.jar. Después de extraer los archivos del jar, el archivo está allí y ha funcionado en otros casos de uso de este build.xml.

Regístrese desde el comando ant -v -debug

52336 $ ant -v -debug
Apache Ant(TM) version 1.9.6 compiled on June 29 2015
Trying the default build file: build.xml
Buildfile: /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.8 in: /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre
Detected OS: Mac OS X
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/build.xml
Setting ro project property: ant.file.type -> file
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/build.xml with URI = file:/Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/build.xml
Setting ro project property: ant.project.name -> product-43
Adding reference: product-43
Setting ro project property: ant.project.default-target -> rebuild
Setting ro project property: ant.file.product-43 -> /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/build.xml
Setting ro project property: ant.file.type.product-43 -> file
Project base dir set to: /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336
 +Target: 
 +Target: clean
 +Target: merge
 +Target: report
 +Target: rebuild
Adding reference: ant.LocalProperties
parsing buildfile jar:file:/usr/local/Cellar/ant/1.9.6/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/local/Cellar/ant/1.9.6/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Setting project property: result.dir -> /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/target
Setting project property: result.classes.dir -> /Users/stephenraghunath/Downloads/gceDist/jacoco-classes
Setting project property: result.report.dir -> /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/target/site/jacoco
Setting project property: result.exec.file -> /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco.exec
parsing buildfile jar:file:/Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar!/org/jacoco/ant/antlib.xml with URI = jar:file:/Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar!/org/jacoco/ant/antlib.xml from a zip file
Finding class org.jacoco.ant.CoverageTask
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/CoverageTask.class
Class org.apache.tools.ant.TaskContainer loaded from parent loader (parentFirst)
Finding class org.jacoco.ant.AbstractCoverageTask
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/AbstractCoverageTask.class
Class org.apache.tools.ant.Task loaded from parent loader (parentFirst)
Class org.jacoco.ant.AbstractCoverageTask loaded from ant loader (parentFirst)
Class org.jacoco.ant.CoverageTask loaded from ant loader (parentFirst)
Class java.lang.Object loaded from parent loader (parentFirst)
Class java.lang.Throwable loaded from parent loader (parentFirst)
Class java.io.IOException loaded from parent loader (parentFirst)
Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst)
Class java.util.Collection loaded from parent loader (parentFirst)
 +Datatype antlib:org.jacoco.ant:coverage org.jacoco.ant.CoverageTask
Finding class org.jacoco.ant.AgentTask
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/AgentTask.class
Class org.jacoco.ant.AgentTask loaded from ant loader (parentFirst)
 +Datatype antlib:org.jacoco.ant:agent org.jacoco.ant.AgentTask
Finding class org.jacoco.ant.ReportTask
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/ReportTask.class
Class org.jacoco.ant.ReportTask loaded from ant loader (parentFirst)
Finding class org.jacoco.core.analysis.ICoverageVisitor
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/analysis/ICoverageVisitor.class
Class org.jacoco.core.analysis.ICoverageVisitor loaded from ant loader (parentFirst)
Finding class org.jacoco.core.analysis.ICoverageNode
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/analysis/ICoverageNode.class
Class org.jacoco.core.analysis.ICoverageNode loaded from ant loader (parentFirst)
Finding class org.jacoco.report.ISourceFileLocator
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/report/ISourceFileLocator.class
Class org.jacoco.report.ISourceFileLocator loaded from ant loader (parentFirst)
Finding class org.jacoco.core.analysis.IBundleCoverage
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/analysis/IBundleCoverage.class
Class org.jacoco.core.analysis.IBundleCoverage loaded from ant loader (parentFirst)
Finding class org.jacoco.ant.ReportTask$SourceFilesElement
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/ReportTask$SourceFilesElement.class
Class org.apache.tools.ant.types.resources.Union loaded from parent loader (parentFirst)
Class org.jacoco.ant.ReportTask$SourceFilesElement loaded from ant loader (parentFirst)
Class java.util.Iterator loaded from parent loader (parentFirst)
Class java.util.List loaded from parent loader (parentFirst)
Finding class org.jacoco.report.IReportVisitor
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/report/IReportVisitor.class
Finding class org.jacoco.report.IReportGroupVisitor
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/report/IReportGroupVisitor.class
Class org.jacoco.report.IReportGroupVisitor loaded from ant loader (parentFirst)
Class org.jacoco.report.IReportVisitor loaded from ant loader (parentFirst)
 +Datatype antlib:org.jacoco.ant:report org.jacoco.ant.ReportTask
Finding class org.jacoco.ant.MergeTask
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/MergeTask.class
Class org.jacoco.ant.MergeTask loaded from ant loader (parentFirst)
 +Datatype antlib:org.jacoco.ant:merge org.jacoco.ant.MergeTask
Finding class org.jacoco.ant.DumpTask
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/DumpTask.class
Class org.jacoco.ant.DumpTask loaded from ant loader (parentFirst)
Finding class org.jacoco.core.tools.ExecDumpClient
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/tools/ExecDumpClient.class
Class org.jacoco.core.tools.ExecDumpClient loaded from ant loader (parentFirst)
Finding class org.jacoco.ant.DumpTask$1
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/DumpTask$1.class
Class org.jacoco.ant.DumpTask$1 loaded from ant loader (parentFirst)
 +Datatype antlib:org.jacoco.ant:dump org.jacoco.ant.DumpTask
Finding class org.jacoco.ant.InstrumentTask
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/ant/InstrumentTask.class
Class org.jacoco.ant.InstrumentTask loaded from ant loader (parentFirst)
Class java.lang.Exception loaded from parent loader (parentFirst)
Class java.io.OutputStream loaded from parent loader (parentFirst)
Class java.io.FileOutputStream loaded from parent loader (parentFirst)
Finding class org.jacoco.core.runtime.IExecutionDataAccessorGenerator
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/runtime/IExecutionDataAccessorGenerator.class
Class org.jacoco.core.runtime.IExecutionDataAccessorGenerator loaded from ant loader (parentFirst)
 +Datatype antlib:org.jacoco.ant:instrument org.jacoco.ant.InstrumentTask
Setting ro project property: ant.project.invoked-targets -> rebuild
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `rebuild' is [clean, merge, report, rebuild]
Complete build sequence is [clean, merge, report, rebuild, ]

clean:

merge:
[antlib:org.jacoco.ant] Could not load definitions from resource org/jacoco/ant/antlib.xml. It could not be found.
Class org.apache.tools.ant.types.ResourceCollection loaded from parent loader (parentFirst)
Class java.io.File loaded from parent loader (parentFirst)
Finding class org.jacoco.core.tools.ExecFileLoader
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/tools/ExecFileLoader.class
Class org.jacoco.core.tools.ExecFileLoader loaded from ant loader (parentFirst)
Finding class org.jacoco.core.data.ISessionInfoVisitor
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/ISessionInfoVisitor.class
Class org.jacoco.core.data.ISessionInfoVisitor loaded from ant loader (parentFirst)
Finding class org.jacoco.core.data.IExecutionDataVisitor
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/IExecutionDataVisitor.class
Class org.jacoco.core.data.IExecutionDataVisitor loaded from ant loader (parentFirst)
Class java.io.BufferedOutputStream loaded from parent loader (parentFirst)
Class java.io.InputStream loaded from parent loader (parentFirst)
Class java.io.BufferedInputStream loaded from parent loader (parentFirst)
Class java.io.FileInputStream loaded from parent loader (parentFirst)
Finding class org.jacoco.core.data.SessionInfoStore
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/SessionInfoStore.class
Class org.jacoco.core.data.SessionInfoStore loaded from ant loader (parentFirst)
Class java.util.ArrayList loaded from parent loader (parentFirst)
Finding class org.jacoco.core.data.ExecutionDataStore
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/ExecutionDataStore.class
Class org.jacoco.core.data.ExecutionDataStore loaded from ant loader (parentFirst)
Class java.util.Map loaded from parent loader (parentFirst)
Class java.util.Set loaded from parent loader (parentFirst)
Class java.util.HashMap loaded from parent loader (parentFirst)
Class java.util.HashSet loaded from parent loader (parentFirst)
fileset: Setup scanner in dir /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336 with patternSet{ includes: [**/*.exec] excludes: [] }
Class org.apache.tools.ant.types.Resource loaded from parent loader (parentFirst)
Class java.lang.String loaded from parent loader (parentFirst)
[jacoco:merge] Loading execution data file /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/10001.exec
Finding class org.jacoco.core.data.ExecutionDataReader
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/ExecutionDataReader.class
Class org.jacoco.core.data.ExecutionDataReader loaded from ant loader (parentFirst)
Finding class org.jacoco.core.data.IncompatibleExecDataVersionException
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/IncompatibleExecDataVersionException.class
Class org.jacoco.core.data.IncompatibleExecDataVersionException loaded from ant loader (parentFirst)
Finding class org.jacoco.core.internal.data.CompactDataInput
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/internal/data/CompactDataInput.class
Class java.io.DataInputStream loaded from parent loader (parentFirst)
Class org.jacoco.core.internal.data.CompactDataInput loaded from ant loader (parentFirst)
Finding class org.jacoco.core.data.SessionInfo
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/SessionInfo.class
Class java.lang.Comparable loaded from parent loader (parentFirst)
Class org.jacoco.core.data.SessionInfo loaded from ant loader (parentFirst)
Class java.lang.IllegalArgumentException loaded from parent loader (parentFirst)
Finding class org.jacoco.core.data.ExecutionData
Loaded from /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/jacoco/lib/jacocoant.jar org/jacoco/core/data/ExecutionData.class
Class org.jacoco.core.data.ExecutionData loaded from ant loader (parentFirst)
Class java.lang.IllegalStateException loaded from parent loader (parentFirst)
Class java.lang.Long loaded from parent loader (parentFirst)
Class org.apache.tools.ant.util.FileUtils loaded from parent loader (parentFirst)

BUILD FAILED
/Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/build.xml:17: Unable to read /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/10001.exec
    at org.jacoco.ant.MergeTask.load(MergeTask.java:87)
    at org.jacoco.ant.MergeTask.execute(MergeTask.java:67)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.Main.runBuild(Main.java:853)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readFully(DataInputStream.java:197)
    at java.io.DataInputStream.readLong(DataInputStream.java:416)
    at org.jacoco.core.data.ExecutionDataReader.readExecutionData(ExecutionDataReader.java:147)
    at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:115)
    at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:92)
    at org.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:59)
    at org.jacoco.ant.MergeTask.load(MergeTask.java:85)
    ... 18 more

Total time: 0 seconds    
1
Stephen Raghunath 14 dic. 2016 a las 14:25

2 respuestas

La mejor respuesta

Según el seguimiento de la pila al final de su registro, esto no tiene nada que ver con el archivo xml dentro de jacocoant.jar, MergeTask falla:

BUILD FAILED
/Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/build.xml:17:
Unable to read /Users/stephenraghunath/Downloads/gceDist/jacoco-classes/df-coverage/exec/bundle/213864/52336/10001.exec
    at org.jacoco.ant.MergeTask.load(MergeTask.java:87)
    ...
Caused by: java.io.EOFException
    at java.io.DataInputStream.readFully(DataInputStream.java:197)
    ...

Y EOFException indica el motivo del error: el archivo 10001.exec está dañado, consulte https : //github.com/jacoco/jacoco/pull/397

2
Godin 14 dic. 2016 a las 13:55

Mientras que @Godin tenía la respuesta correcta para lo que reveló el seguimiento de la pila. Para resolver el problema es lo siguiente:

JaCoCo cuando el volcado de información de cobertura es una tarea asincrónica y no estará disponible de inmediato. Puede que los archivos tarden unos minutos en escribirse por completo. Por lo tanto, necesitábamos automatizar un tiempo de espera apropiado antes de que el entorno que estaba creando estos archivos exec los cargara en s3 (10 segundos).

Este fue el caso de las instancias AWS Ec2.

2
Stephen Raghunath 15 dic. 2016 a las 10:35