Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException: 291 with cobertura report from scoverage #73

Open
arahuja opened this issue Jun 15, 2015 · 6 comments
Open

Comments

@arahuja
Copy link

arahuja commented Jun 15, 2015

I'm using scoverage:1.1.0 to generate a cobertura report and it is created in target/cobertura.xml

Using coveralls maven plugin:3.1.0

          <plugin>
            <groupId>org.eluder.coveralls</groupId>
              <artifactId>coveralls-maven-plugin</artifactId>
              <version>3.1.0</version>
              <configuration>
                <coberturaReports>
                 <param>${project.build.directory}/cobertura.xml</param>
                </coberturaReports>
              <sourceDirectories>
                <param>${basedir}</param>
              </sourceDirectories>
              </configuration>
          </plugin>

I get the following exception:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.1.0:report (default-cli) on project guacamole: Build error: 291 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.1.0:report (default-cli) on project guacamole: Build error
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    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:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Build error
    at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.execute(CoverallsReportMojo.java:236)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 291
    at org.eluder.coveralls.maven.plugin.domain.Source.addCoverage(Source.java:92)
    at org.eluder.coveralls.maven.plugin.parser.CoberturaParser.onEvent(CoberturaParser.java:68)
    at org.eluder.coveralls.maven.plugin.parser.AbstractXmlEventParser.parse(AbstractXmlEventParser.java:64)
    at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.writeCoveralls(CoverallsReportMojo.java:348)
    at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.execute(CoverallsReportMojo.java:225)
    ... 21 more
@trautonen
Copy link
Owner

My guess is that you have multi-module project containing duplicate package/class names. If this is the case, there is no current solution available because it's impossible to detect the correct submodule from aggregated Cobertura report. See issue #56 for more details.

If the earlier is not the case then I would need a bit more information about the issue. Are there any weird encodings or new line characters used in the code files?

@arahuja
Copy link
Author

arahuja commented Jun 16, 2015

@trautonen Thanks for the reply - this is a single module project and I don't believe package names should overlap at all - but I can double check in case it accidently happened. There also should not be any weird encodings, or new line characters used.

Is possible to check which source file is causing the error or get more information on what can't be found?

@trautonen
Copy link
Owner

Ok. I created a new snapshot that improves the exception message for the out of bounds issue. Could you add Sonatype's snapshot repository to your project and test with the 3.2.0-SNAPSHOT version.

        <repository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

With those above set run your build for example on local machine with mvn -U -DdryRun=true org.eluder.coveralls:coveralls-maven-plugin:report

@arahuja
Copy link
Author

arahuja commented Jun 16, 2015

Thanks for the update - I had to add to it pluginRepositories actually.

Running that says

Build error: Line number 292 is greater than the source file src/main/scala/org/hammerlab/guacamole/LociSet.scala size

which is true, that file only has 286 lines.

There are many tests that list a line number higher than that in the cobertura file unfortunately - the tests that seem to have higher line number on an inner class, could that be causing issues? Must be an issue with scoverage than.

Thanks!

@gslowikowski
Copy link

Can you create test project (for scoverage) generating wrong line numbers?

@ryan-williams
Copy link

I think I have this working in the repo @arahuja and I are concerned about, so we can probably close this.

Either something was fixed here or in maven-coveralls-plugin in the last year, or we both were tricked by not diligently-enough running mvn clean between running other non-scoverage coverage-report-generation tools and attempting with scoverage (which definitely happened to me at least once yesterday before I ultimately got things working).

I described my full configs for Maven+Scala+Scoverage+Coveralls here: #98 (comment).

Thanks for following up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants