Scanner for Maven error: 'requirement failed' , in custom plugin

sonarqube

(Laura Chen) #1

When I try to run sonar maven command against scala code using scoverage plugin,
Here’s the maven command:

mvn scoverage:report sonar:sonar -am -pl module1 -Dsonar.projectKey=projectkey -Dsonar.projectName=projectname -Dsonar.host.url=https://sonar-xxxx.com:443/ -Dsonar.core.codeCoveragePlugin=scoverage -Dsonar.scoverage.reportPath=target/scoverage.xml -Dsonar.modules=module1 -Dsonar.language=scala -Dmaven.test.failure.ignore=true -Dsparknrt.sonar.projectName=module1 -Dsparknrt.sonar.sources=src/main/scala -Dsparknrt.sonar.projectBaseDir=../module1 -X -e

Hit below exception:

_[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project xxxxxx: requirement failed -> [Help 1]_
_org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project XXXX: requirement failed_
_	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)_
_	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:863)_
_	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)_
_	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)_
_	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:498)_
_	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: requirement failed_
_	at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:67)_
_	at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:104)_
_	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)_
_	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)_
_	... 20 more_
_Caused by: java.lang.IllegalArgumentException: requirement failed_
_	at scala.Predef$.require(Predef.scala:212)_
_	at com.buransky.plugins.scoverage.pathcleaner.BruteForceSequenceMatcher.<init>(BruteForceSequenceMatcher.scala:53)_
_	at com.buransky.plugins.scoverage.sensor.ScoverageSensor.createPathSanitizer(ScoverageSensor.scala:77)_
_	at com.buransky.plugins.scoverage.sensor.ScoverageSensor.analyse(ScoverageSensor.scala:65)_
_	at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)_
_	at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)_
_	at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)_
_	at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)_
_	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)_
_	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)_
_	at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)_
_	at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)_
_	at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234)_
_	at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)_
_	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)_
_	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)_
_	at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)_
_	at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)_
_	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)_
_	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)_
_	at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)_
_	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)_
_	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)_
_	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)_
_	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:498)_
_	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)_
_	at com.sun.proxy.$Proxy37.execute(Unknown Source)_
_	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)_
_	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)_
_	at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:65)_
_	... 23 more_

The scoverage plugin itself works perfectly with maven when not using this sonar maven plugin, by adding below to my project pom.xml
scoverage


(Janos Gyerik) #2

Judging by this part of the stack trace, it seems the problem comes from the plugin:

_Caused by: java.lang.IllegalArgumentException: requirement failed_
_	at scala.Predef$.require(Predef.scala:212)_
_	at com.buransky.plugins.scoverage.pathcleaner.BruteForceSequenceMatcher.<init>(BruteForceSequenceMatcher.scala:53)_
_	at com.buransky.plugins.scoverage.sensor.ScoverageSensor.createPathSanitizer(ScoverageSensor.scala:77)_
_	at com.buransky.plugins.scoverage.sensor.ScoverageSensor.analyse(ScoverageSensor.scala:65)_
_	at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)_

I suggest to contact the plugin developers instead.