sonar-scoverage-plugin icon indicating copy to clipboard operation
sonar-scoverage-plugin copied to clipboard

Maven says 'None.get'

Open JJWTimmer opened this issue 7 years ago • 3 comments

I'm hitting a None.get in maven:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project workflow2: None.get -> [Help 1]

-X stacktrace pointing to: https://github.com/RadoBuransky/sonar-scoverage-plugin/blob/20af12dbaa161d590e0365322d739690abd6d753/plugin/src/main/scala/com/buransky/plugins/scoverage/xml/XmlScoverageReportConstructingParser.scala#L146

What can I do to debug it?

JJWTimmer avatar Aug 30 '17 12:08 JJWTimmer

I found that the sub-sub-module that is being processed has a cobertura.xml & scoverage.xml of which the packages section is empty. I don't know how or what, but there are other modules on the same level where the packages are just there.

JJWTimmer avatar Aug 30 '17 15:08 JJWTimmer

Hi,

I got the same issue:

I was creating a new module which contains packages without classes, and packages section was empty as you mentioned, then I created a dummy case class called: case class Foo(), and it didn't worked.

Finally I had to create this:

class Foo {
  val bar: String = "bar"
}

object Foo {
  def dummy(): Foo = new Foo()
}

And packages section was created properly.

sergiotudela avatar Dec 13 '17 14:12 sergiotudela

:+1:

A codebase that generates an empty scoverage.xml (no tests yet) will cause this. scoverage.xml content:

<scoverage 
statement-count="0" statements-invoked="0" statement-rate="100.00" branch-rate="100.00" version="1.0" timestamp="1519982101796">
    <packages> </packages>
</scoverage>

Will result in:

Caused by: java.util.NoSuchElementException: None.get
	at scala.None$.get(Option.scala:347)
	at scala.None$.get(Option.scala:345)
	at com.buransky.plugins.scoverage.xml.XmlScoverageReportConstructingParser$DirOrFile.toStatementCoverage(XmlScoverageReportConstructingParser.scala:146)

jorkzijlstra avatar Mar 02 '18 09:03 jorkzijlstra