trautonen / coveralls-maven-plugin

Maven plugin for submitting Java code coverage reports to Coveralls web service.
MIT License
312 stars 123 forks source link

Build error: Line number [...] is greater than the source file #102

Open ak80 opened 7 years ago

ak80 commented 7 years ago

Hi Team,

I was unable to find a solution to my problem, when using coveralls-maven-plugin in my project. I have mixed Java and Kotlin sources and do my coverage reporting with jacoco. My build fails when I do a

mvn test jacoco:report coveralls:report

with this error:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:4.2.0:report (default-cli) on project BinaryDataParser: Build error: Line number 90 is greater than the source file bdp-processor/src/main/java/org/ak80/bdp/MappedClass.kt size -> [Help 1]

Any idea what could be the problem? Looking at the htm repors created by jacoco, everything seems fine.

Thank you for your time

Alex

ak80 commented 7 years ago

I see now, that this is a known problem, at least with Scala, see #98 and #73 and #82. Still any idea how to workaround this with Kotlin?

trautonen commented 7 years ago

My guess is that something similar happens here what happens with scalac. Sorry that at the moment I have no time to investigate this more.

You could check the exact JaCoCo output XML files and the line numbers found there. If the line numbers are off like what happens with scalac then I really don't know what we can do about it.

ak80 commented 7 years ago

Alright, thank you for your reply. Maybe I can reach out to the Kotlin folks :-)

josephlbarnett commented 7 years ago

@trautonen Looks like the Kotlin issue is caused by its compiler inlining functions, and the extra lines are the best solution they have: https://youtrack.jetbrains.com/issue/KT-9766

Given this, would you be more open to a PR like https://github.com/trautonen/coveralls-maven-plugin/pull/97 being acceptable?

sdorra commented 6 years ago

I've the same problem with a plain java project. Please have a look at spotter.

anyulled commented 6 years ago

still no workarounds for this? I'm having the following error message: Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:4.3.0:report (default-cli) on project jpademo: Build error: Line number 13 is greater than the source file src/main/kotlin/com/anyulled/jpademo/JpaDemoApplication.kt size -> [Help 1]

davinkevin commented 5 years ago

I have the same result with Kotlin and JaCoCo in version 7.X. If I upgrade to JaCoCo 8.X, the system shows me some error about file "Comparison.kt" not found. This file is the result of an inner class generated by the Kotlin code for lambda and name like this by JaCoCo.

Build pipeline in 0.7.5: https://gitlab.com/davinkevin/Podcast-Server/-/jobs/265523285 Build pipeline in 0.8.4: https://gitlab.com/davinkevin/Podcast-Server/-/jobs/265523712

For information, I migrated to codecov which do the job for me.