Jacoco EOF / Zip error

1,193 views
Skip to first unread message

Tim Webster

unread,
Dec 5, 2013, 12:19:05 PM12/5/13
to jac...@googlegroups.com

I'm trying to generate a Jacoco report on a Maven project and can't figure out what's causing this error.  There is nothing special about the project, and the same configuration works on other projects.

the data file is present and looks OK (as far as I can tell)...from the output:

surefireArgLine set to -javaagent:C:\Users\twebster\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\intellij-workspaces\my-project-trunk\myproject\target\jacoco-ut.exec

I thought maybe it was trying to instrument/analyze some code not from my project, so I did an <includes/> to only include source from my project.

Maven POM configuration:

                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>pre-unit-test</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <destFile>target/jacoco-ut.exec</destFile>
                                    <propertyName>surefireArgLine</propertyName>
                                    <includes>
                                        <include>myproject.*</include>
                                    </includes>
                                </configuration>
                            </execution>
                            <execution>
                                <id>post-unit-test</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <dataFile>target/jacoco-ut.exec</dataFile>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${surefireArgLine}</argLine>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/java/testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>


Error:


[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.6.3.201306030806:report (post-unit-test) on project jert: An error has occurred in JaCoCo report generation. Error while creating report: null: EOFException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jacoco:jacoco-maven-plugin:0.6.3.201306030806:report (post-unit-test) on project jert: An error has occurred in JaCoCo report generation.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred in JaCoCo report generation.
at org.jacoco.maven.ReportMojo.execute(ReportMojo.java:222)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 25 more
Caused by: org.apache.maven.reporting.MavenReportException: Error while creating report: null
at org.jacoco.maven.ReportMojo.executeReport(ReportMojo.java:238)
at org.jacoco.maven.ReportMojo.execute(ReportMojo.java:220)
... 27 more
Caused by: java.io.EOFException
at java.util.zip.ZipInputStream.readFully(ZipInputStream.java:409)
at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:254)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:82)
at org.jacoco.core.analysis.Analyzer.analyzeZip(Analyzer.java:234)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:167)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:197)
at org.jacoco.maven.BundleCreator.createBundle(BundleCreator.java:68)
at org.jacoco.maven.ReportMojo.createReport(ReportMojo.java:262)
at org.jacoco.maven.ReportMojo.executeReport(ReportMojo.java:235)
... 28 more

Marc Hoffmann

unread,
Dec 5, 2013, 12:43:56 PM12/5/13
to jac...@googlegroups.com
Hi Tim,

this means that the report goal finds a file in your target directory
which looks like a ZIP file (from its signature) but actually is not a
valid ZIP file.

You might use the includes/excludes parameter to identify the
problematic file.

Cheers,
-marc

On 2013-12-05 18:19, Tim Webster wrote:
> I'm trying to generate a Jacoco report on a Maven project and can't
> figure out what's causing this error. There is nothing special about
> the project, and the same configuration works on other projects.
>
> the data file is present and looks OK (as far as I can tell)...from
> the output:
>
> surefireArgLine set to
> -javaagent:C:Userstwebster.m2repositoryorgjacocoorg.jacoco.agent.6.3.201306030806org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:intellij-workspacesmy-project-trunkmyprojecttargetjacoco-ut.exec
> --
> 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 jacoco+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out [1].
>
>
> Links:
> ------
> [1] https://groups.google.com/groups/opt_out

Tim Webster

unread,
Dec 6, 2013, 5:08:58 AM12/6/13
to jac...@googlegroups.com
Hi,

It seems that no matter what I include/exclude, the error still occurs.  Am I using it correctly?  I am doing it in the prepare-agent goal.  I've tried only including a single class, or excluding everything, or only including class files, etc. Nothing works.  There are some .png files in target/classes, I though maybe it was them, but excluding those don't seem to help (exclude **/*.png).

it's a problem that you can't tell what file is causing the error, or what is actually being included/excluded.

I've tried:


<includes>
  <include>**/*.class</include>
<includes>

or 

<includes>
  <include>com.MyClass.class</include>
<includes>

or

<excludes>
  <exclude>**</exclude>
</excludes>



                          <execution>
                                <id>pre-unit-test</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <destFile>target/jacoco-ut.exec</destFile>
                                    <propertyName>surefireArgLine</propertyName>
                                    <includes>
                                        <include>**/*.class</include>
                                    </includes>
                                </configuration>
                            </execution>




--
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 jacoco+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Check out my wine blog: http://timswineblog.blogspot.com/

Tim Webster

unread,
Dec 6, 2013, 6:56:24 AM12/6/13
to jacoco
I worked it out (after downloading the source, wrapping the exception with some debug information, and building it locally).  It was a spreadsheet file it was complaining about.  To fix it I added the exclusions to the <plugin> section instead of the <execution> section.

Thanks,

Tim
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages