-
Notifications
You must be signed in to change notification settings - Fork 155
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
Sonar PMD Analysis issue #107
Comments
Hi @jbdundas To be able to help you, I need more information. Right now, I can only see that the exception is being thrown within PMD, not within the plugin code. |
@jensgerdes Thanks for your update. Actually, this error is coming up for many files during the analysis. |
Note that we do not install PMD on our own. It comes directly through Sonarqube 6.7 LTS |
Can you tell us what we need to do here? |
What kind of build management system do you use. It seems that the code uses Java 1.7+ syntax but the plugin thinks it to be Java 1.6 or lower. EDIT: I see, it is maven. Do you set the correct compiler source and target? E.g. |
Hi - Yes, we did to 1.8. |
We are currently running into the same issue |
we are facing the issue and error below Error during SonarQube Scanner execution |
We ve got the same kind of behavior with SonarQube 7.9.2 & PMD plugin 3.2.1 :
Any idea of what might cause this issue and how to fix it ? Thanks for helping :) |
Is this still relevant? |
Hi,
We are getting this error even after adding the sonar.java.source property. Can you please tell us how to fix this. We have set 1.8 for this run but we still see 1.6 in some cases.
[ERROR] Fail to execute PMD. Following file is ignored: abc.java
net.sourceforge.pmd.PMDException: Error while parsing file:///abc.java
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:99)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:51)
at org.sonar.plugins.pmd.PmdTemplate.process(PmdTemplate.java:101)
at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:131)
at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:98)
at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:80)
at org.sonar.plugins.pmd.PmdSensor.execute(PmdSensor.java:71)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:177)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:291)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:286)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:284)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:264)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
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.$Proxy23.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:65)
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:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
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:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
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: net.sourceforge.pmd.lang.java.ast.ParseException: Line 11, Column 52: Cannot use the diamond generic notation when running in JDK inferior to 1.7 mode!
at net.sourceforge.pmd.lang.java.ast.JavaParser.throwParseException(JavaParser.java:23)
at net.sourceforge.pmd.lang.java.ast.JavaParser.checkForBadDiamondUsage(JavaParser.java:88)
at net.sourceforge.pmd.lang.java.ast.JavaParser.TypeArguments(JavaParser.java:2269)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceType(JavaParser.java:2194)
at net.sourceforge.pmd.lang.java.ast.JavaParser.AllocationExpression(JavaParser.java:4622)
at net.sourceforge.pmd.lang.java.ast.JavaParser.PrimaryPrefix(JavaParser.java:3917)
at net.sourceforge.pmd.lang.java.ast.JavaParser.PrimaryExpression(JavaParser.java:3730)
at net.sourceforge.pmd.lang.java.ast.JavaParser.PostfixExpression(JavaParser.java:3592)
at net.sourceforge.pmd.lang.java.ast.JavaParser.UnaryExpressionNotPlusMinus(JavaParser.java:3554)
at net.sourceforge.pmd.lang.java.ast.JavaParser.UnaryExpression(JavaParser.java:3407)
at net.sourceforge.pmd.lang.java.ast.JavaParser.MultiplicativeExpression(JavaParser.java:3301)
at net.sourceforge.pmd.lang.java.ast.JavaParser.AdditiveExpression(JavaParser.java:3248)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ShiftExpression(JavaParser.java:3191)
at net.sourceforge.pmd.lang.java.ast.JavaParser.RelationalExpression(JavaParser.java:3130)
at net.sourceforge.pmd.lang.java.ast.JavaParser.InstanceOfExpression(JavaParser.java:3094)
at net.sourceforge.pmd.lang.java.ast.JavaParser.EqualityExpression(JavaParser.java:3041)
at net.sourceforge.pmd.lang.java.ast.JavaParser.AndExpression(JavaParser.java:3001)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ExclusiveOrExpression(JavaParser.java:2961)
at net.sourceforge.pmd.lang.java.ast.JavaParser.InclusiveOrExpression(JavaParser.java:2921)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ConditionalAndExpression(JavaParser.java:2881)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ConditionalOrExpression(JavaParser.java:2841)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ConditionalExpression(JavaParser.java:2803)
at net.sourceforge.pmd.lang.java.ast.JavaParser.Expression(JavaParser.java:2660)
at net.sourceforge.pmd.lang.java.ast.JavaParser.VariableInitializer(JavaParser.java:1460)
at net.sourceforge.pmd.lang.java.ast.JavaParser.VariableDeclarator(JavaParser.java:1335)
at net.sourceforge.pmd.lang.java.ast.JavaParser.LocalVariableDeclaration(JavaParser.java:5050)
at net.sourceforge.pmd.lang.java.ast.JavaParser.BlockStatement(JavaParser.java:4970)
at net.sourceforge.pmd.lang.java.ast.JavaParser.Block(JavaParser.java:4931)
at net.sourceforge.pmd.lang.java.ast.JavaParser.MethodDeclaration(JavaParser.java:1615)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceBodyDeclaration(JavaParser.java:1239)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceBody(JavaParser.java:1194)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceDeclaration(JavaParser.java:650)
at net.sourceforge.pmd.lang.java.ast.JavaParser.TypeDeclaration(JavaParser.java:539)
at net.sourceforge.pmd.lang.java.ast.JavaParser.CompilationUnit(JavaParser.java:276)
at net.sourceforge.pmd.lang.java.AbstractJavaParser.parse(AbstractJavaParser.java:59)
at net.sourceforge.pmd.SourceCodeProcessor.parse(SourceCodeProcessor.java:111)
at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:175)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:96)
... 60 common frames omitted
Please help us out.
Thanks.
The text was updated successfully, but these errors were encountered: