RadoBuransky / sonar-scoverage-plugin

Sonar plugin for Scala statement coverage tool
GNU Lesser General Public License v3.0
75 stars 31 forks source link

null: MojoExecutionExc eption: NoSuchElementException while running sonar #13

Open jjayeshgohil opened 9 years ago

jjayeshgohil commented 9 years ago

Hi,

Hi,

I have a scala project which is built using maven scoverage-maven-plugin. It builds as well produces coverage report as scoverage.xml.

However when sonar:sonar -Dsonar.language=scala -Dsonar.scoverage.reportPath=target\scoverage.xml is executed it fails with NoSuchElementException.

I have attached the full stack trace for reference.

Can anyone help to resolve this issue.

Thanks in advance.

RadoBuransky commented 9 years ago

Hi. I can't see the attachment. If you can please send me the log and maybe event the scoverage.xml. Thanks

jjayeshgohil commented 9 years ago

Hi,

My bad for missing attachments. Here's the log & coverage file attache as .jpg. Please change it to .log & .xml respectively.

sonar scoverage

RadoBuransky commented 9 years ago

I can't get the attachments.

jjayeshgohil commented 9 years ago

Not sure why it's getting converted to links. Below is the stack trace and XML contents.

[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.070s [INFO] Finished at: Wed May 06 10:17:33 CDT 2015 [INFO] Final Memory: 30M/706M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project scoverage-maven-samples: null: MojoExecutionException: NoSuchElementException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project scoverage-maven-samples: null 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:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) 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) Caused by: org.apache.maven.plugin.MojoExecutionException at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41) at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:139) at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:132) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.util.NoSuchElementException at com.google.common.collect.AbstractIterator.next(AbstractIterator.java:152) at scala.collection.convert.Wrappers$JIteratorWrapper.next(Wrappers.scala:42) at scala.collection.IterableLike$class.head(IterableLike.scala:91) at scala.collection.AbstractIterable.head(Iterable.scala:54) at scala.collection.TraversableLike$class.headOption(TraversableLike.scala:436) at scala.collection.AbstractTraversable.headOption(Traversable.scala:105) at com.buransky.plugins.scoverage.sensor.ScoverageSensor.processFile(ScoverageSensor.scala:152) at com.buransky.plugins.scoverage.sensor.ScoverageSensor.com$buransky$plugins$scoverage$sensor$ScoverageSensor$$processChild(ScoverageSensor.scala:201) at com.buransky.plugins.scoverage.sensor.ScoverageSensor$$anonfun$processChildren$1.apply(ScoverageSensor.scala:195) at com.buransky.plugins.scoverage.sensor.ScoverageSensor$$anonfun$processChildren$1.apply(ScoverageSensor.scala:195) at scala.collection.immutable.List.foreach(List.scala:309) at com.buransky.plugins.scoverage.sensor.ScoverageSensor.processChildren(ScoverageSensor.scala:195) at com.buransky.plugins.scoverage.sensor.ScoverageSensor.processProject(ScoverageSensor.scala:136) at com.buransky.plugins.scoverage.sensor.ScoverageSensor.analyse(ScoverageSensor.scala:55) at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79) at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70) at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:131) at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178) at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199) at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194) at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192) at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192) at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187) at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56) at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44) at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82) at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175) at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163) at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74) at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) at java.security.AccessController.doPrivileged(Native Method) at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) at org.sonar.runner.api.Runner.execute(Runner.java:100) at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:135) ... 22 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn -rf :scoverage-maven-samples

<scoverage statement-count="1" statements-invoked="1" statement-rate="100.00" branch-rate="100.00" version="1.0" timestamp="1430925211889">

RadoBuransky commented 9 years ago

That's weird. It looks like a bug in Scala/Google lib, because headOption throws NoSuchElementException which is wrong for sure. Please wait a bit, I will release plugin for Sonar 5.1 where latest Scala 2.11.x will be used.

RadoBuransky commented 9 years ago

I see the problem now. I'll fix it soon. Thanks

jjayeshgohil commented 9 years ago

Hi,

Just to be confirmed on my side, we are using Sonarqube 4.3.2. Will the fix/new plugin version be compatible or needs sonar upgrade to 5.1. Also by when you think plugin will be available?

I hope you don't mind these questions as I need to inform my development teams accordingly on the support.

Thanks for looking into this.

Thanks,

Jayesh

RadoBuransky commented 9 years ago

I'll fix this for the current version of the plugin too so that you can use it. I think you will have it on monday. By the way, I have posted a question to Scala forum, because this is an interesting issue: https://groups.google.com/forum/#!topic/scala-language/F2e5pZtGDZo

RadoBuransky commented 9 years ago

Try this release please and let me know: https://github.com/RadoBuransky/sonar-scoverage-plugin/releases/tag/v4.2.0

jjayeshgohil commented 9 years ago

Hi,

Th plugin worked for the example code. I will test in on the real code and let you know. Thank you.

-Jayesh

jjayeshgohil commented 9 years ago

Hi Rado,

Plugin seems to work for scala. However it fails when it does not find scoverage.xml. I have a multi-module project with some component are java & other are scala. So obviousble scoverage does not exist for java components or for components with packaging as POM. It fails with following exception. Is there a way to ignore this?

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project publish-tile-project: None.get -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project publish-tile-project: None.get 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:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) 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)

Thanks,

Jayesh

jjayeshgohil commented 9 years ago

Dashboards Projects Measures Issues Quality Profiles Quality Gates Administrator Settings Configuration MapCore :: Publish :: Hammer Commons Dashboard Hotspots Issues Time Machine TOOLS Components Issues Drilldown Libraries Compare Embrace Quality Configure widgetsManage dashboards Version DEV-SNAPSHOT - May 13 2015 16:03 Time changes...

Statement coverage : 33.7% % Statement coverage : 33.7% % Issues 0 Technical Debt 0 Blocker 0
Critical 0
Major 0
Minor 0
Info 0
More Most Violated Rules Any severity

No result Events
All

May 13 2015 Version DEV-SNAPSHOT
Key: com.here.map.core:hammer-commons Profile: sonar (version 1) SonarQube™ technology is powered by SonarSource SA Version 4.3.2 - Community - Documentation - Get Support - Plugins

RadoBuransky commented 9 years ago

It seems that you're not using the latest version. Could please send me the list of you plugin *.jar files? /extensions/plugins

jjayeshgohil commented 9 years ago

We are at Sonar 4.3.2. Below are the lists of plugin jars.

plugins> ls -la total 47644 drwxr-xr-x 3 bisonadm crm 4096 May 11 10:45 . drwxr-xr-x 6 bisonadm crm 4096 Sep 1 2014 .. -rw-r--r-- 1 bisonadm crm 105 Sep 2 2014 README.txt drwxrwxr-x 2 bisonadm crm 4096 Sep 2 2014 removed -rw-r--r-- 1 bisonadm crm 9188 Sep 2 2014 sonar-branding-plugin-0.5.jar -rw-r--r-- 1 bisonadm crm 7152 Sep 2 2014 sonar-build-breaker-plugin-1.1.jar -rw-r--r-- 1 bisonadm crm 1094654 Feb 3 04:39 sonar-checkstyle-plugin-2.1.1.jar -rw-r--r-- 1 bisonadm crm 1419323 Sep 2 2014 sonar-clover-plugin-3.0.jar -rw-r--r-- 1 bisonadm crm 10325 Feb 3 04:39 sonar-cobertura-plugin-1.6.3.jar -rw-r--r-- 1 bisonadm crm 909055 Sep 2 2014 sonar-csharp-plugin-3.2.1.jar -rw-r--r-- 1 bisonadm crm 1818468 Sep 2 2014 sonar-cxx-plugin-0.9.jar -rw-r--r-- 1 bisonadm crm 6228395 Feb 3 04:39 sonar-findbugs-plugin-3.1.jar -rw-r--r-- 1 bisonadm crm 4931 Sep 2 2014 sonar-googleanalytics-plugin-1.0.jar -rw-r--r-- 1 bisonadm crm 10918277 Sep 2 2014 sonar-groovy-plugin-1.0.1.jar -rw-r--r-- 1 bisonadm crm 1012731 Sep 2 2014 sonar-issues-report-plugin-1.2.1.jar -rw-r--r-- 1 bisonadm crm 2108958 Feb 3 04:39 sonar-java-plugin-2.5.1.jar -rw-r--r-- 1 bisonadm crm 730102 Sep 2 2014 sonar-javascript-plugin-2.0.jar -rw-r--r-- 1 bisonadm crm 1864762 Sep 2 2014 sonar-jira-plugin-1.2.jar -rw-r--r-- 1 bisonadm crm 30646 Sep 2 2014 sonar-ldap-plugin-1.4.jar -rw-r--r-- 1 bisonadm crm 11367 Nov 18 00:53 sonar-pdfreport-plugin-1.3.2.jar -rw-r--r-- 1 bisonadm crm 5922 Sep 2 2014 sonar-piwik-plugin-1.0.jar -rw-r--r-- 1 bisonadm crm 5885881 Sep 2 2014 sonar-pmd-plugin-2.2.jar -rw-r--r-- 1 bisonadm crm 675007 Sep 2 2014 sonar-python-plugin-1.3.jar -rw-r--r-- 1 bisonadm crm 1718857 Sep 2 2014 sonar-scm-activity-plugin-1.8.jar -rw-r--r-- 1 bisonadm crm 6458115 Sep 24 2014 sonar-scoverage-plugin-1.1.0.jar_Bug -rwxrwxr-x 1 bisonadm crm 5667262 May 11 10:45 sonar-scoverage-plugin-4.2.0.jar -rw-r--r-- 1 bisonadm crm 34462 Sep 2 2014 sonar-stylecop-plugin-1.0.jar

RadoBuransky commented 9 years ago

Your stack trace doesn't match source code of the version 4.2.0. It really looks like an older version of the plugin is used.

jjayeshgohil commented 9 years ago

It shows correct version on the sonar instance under installed plugins.

Scoverage [scoverage] 4.2.0 Sonar plugin for importing statement coverage reports generated by Scoverage.

RadoBuransky commented 9 years ago

I am clueless at the moment...

jjayeshgohil commented 9 years ago

Hi Rado,

Same error is being reproduced with SonarQube 5.1 as well. Is it possible for you too look into this issue?

Thanks,

Jayesh

RadoBuransky commented 9 years ago

I will try, but my twins usually have different view on my spare time.