Hi,

thanks for the stack trace! The trace indicates that "E:\test\jacoco.exec" is not a valid execution data file or it has been corrupted somehow.

If you can provide this file I can have a look what the issue is. You can also inspect the file yourself using our code example here:

http://www.eclemma.org/jacoco/trunk/doc/examples/java/ExecDump.java

Regards,
-marc



On 08.09.16 12:33, [email protected] wrote:
On Wednesday, September 7, 2016 at 5:28:28 PM UTC+5:30, [email protected] wrote:
Can we copy jacoco.exec ( execution data file) generated on linux to Windows 
and use it as input for merge ANT target? We are getting cannot read 
file(execution data file copied from linux) error while merge. Is there any way 
to fix this? More details below...

We want to merge execution data files generated on different envs (one generated on Linux 
for selenium and other generated on Windows for jUnits) to get a combined coverage 
report. We are using ANT, "jacoco:merge" is being run on Windows. We have 
copied jacoco.exec from Linux to Windows and trying to merge the files.




Hi Marc,

Here is the complete stacktrace

[jacoco:merge] Loading execution data file E:\test\jacoco.exec

BUILD FAILED
E:\test\build.xml:571: Unable to read E:\test\jacoco.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.GeneratedMethodAccessor4.invoke(Unknown Source)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:497)
         at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a: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(DefaultExe
cutor.java:41)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
         at org.apache.tools.ant.Main.runBuild(Main.java:854)
         at org.apache.tools.ant.Main.startAnt(Main.java:236)
         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.IOException: Unknown block type a.
         at 
org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReade
r.java:116)
         at 
org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.jav
a:87)
         at org.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:59)
         at org.jacoco.ant.MergeTask.load(MergeTask.java:85)
         ... 17 more



Below is my ANT target. In this mod1 jacoco.exec file was copied from a linux 
box and mod2 jacoco.exec files were generated on same windows m/c where merge 
target is run.

<target name="merge-all-modules">
        <jacoco:merge destfile="${mytest.dir}/target/merged.exec">
                                <fileset dir="${mytest.dir}/target/mod2" 
includes="jacoco.exec" />
                                <fileset dir="${mytest.dir}/target/mod1" 
includes="*.exec" />
                        </jacoco:merge>
                        <jacoco:report>
                                <executiondata>
                                        <file 
file="${mytest.dir}/target/merged.exec" />
                                </executiondata>
                                <structure name="MyTestPrj">
                                                                <group 
name="module1">
                                                                        
<classfiles>
                                                                                <fileset 
dir="${mytest.dir}/output/classes"/>
                                                                        
</classfiles>
                                                                        <sourcefiles 
encoding="UTF-8">
                                                                                <fileset 
dir="${mytest.dir}/source"/>
                                                                        
</sourcefiles>
                                                                </group>
                                                                <group 
name="module2">
                                                                        
<classfiles>
                                                                                <fileset 
dir="${mytest.dir}/output/mod1classes"/>
                                                                        
</classfiles>
                                                                        <sourcefiles 
encoding="UTF-8">
                                                                                <fileset 
dir="${mytest.dir}/mod1src"/>
                                                                        
</sourcefiles>
                                                                </group>
                                                        </structure>
                                <html destdir="${mytest.dir}/target/output" />
                        </jacoco:report>
                </target>


--
You received this message because you are subscribed to the Google Groups "JaCoCo 
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/893ab63f-6fbe-4535-75aa-8284adb51841%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to