SonarQube无法分析文件:Java文件

时间:2017-06-22 14:02:27

标签: java jenkins sonarqube

org.sonar.squidbridge.api.AnalysisException:SonarQube无法分析文件的Java文件

我正在使用SonarQube版本5.6.1

这些是我的属性,我使用的是Java 8:

sonar.projectKey=Project1
sonar.projectName=ProProject
sonar.projectVersion=Layer1
sonar.verbose=true
sonar.sources=src
sonar.qualitygate=SonarQube way 
sonar.libraries=lib
sonar.tests=Tests
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true 
sonar.analysis.mode=publish
sonar.issuesReport.console.enable=true
sonar.sourceEncoding=UTF-8

在我的sonarQube分析期间,我在我的java代码中收到这样的错误。

ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(AccessController.java:594)
    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.sonar.runner.Main.executeTask(Main.java:70)
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:53)
Caused by: org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : '/application/scanner/jenkins/workspace/Test/src/Cases/address/PerAddress.java'
    at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:93)
    at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:67)
    at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:133)
    at org.sonar.java.JavaSquid.scan(JavaSquid.java:126)
    at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:93)
    at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
    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.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:508)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 9 more
Caused by: java.lang.NullPointerException
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212)
    at org.sonar.java.se.ProgramState.decreaseReference(ProgramState.java:212)
    at org.sonar.java.se.ProgramState.cleanupDeadSymbols(ProgramState.java:256)
    at org.sonar.java.se.ExplodedGraphWalker.cleanUpProgramState(ExplodedGraphWalker.java:241)
    at org.sonar.java.se.ExplodedGraphWalker.handleBlockExit(ExplodedGraphWalker.java:249)
    at org.sonar.java.se.ExplodedGraphWalker.execute(ExplodedGraphWalker.java:199)
    at org.sonar.java.se.ExplodedGraphWalker.visitMethod(ExplodedGraphWalker.java:152)
    at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl.java:218)
    at org.sonar.java.se.SymbolicExecutionVisitor.visitNode(SymbolicExecutionVisitor.java:49)
    at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:95)
    at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
    at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
    at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
    at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
    at org.sonar.java.ast.visitors.SubscriptionVisitor.scanTree(SubscriptionVisitor.java:78)
    at org.sonar.java.ast.visitors.SubscriptionVisitor.scanFile(SubscriptionVisitor.java:64)
    at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:120)
    at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:84)
    ... 39 more
ERROR: 
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Execute SonarQube Scanner' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Notifying upstream projects of job completion
Finished: FAILURE

我有什么遗漏

1 个答案:

答案 0 :(得分:1)

可能已在SonarQube is unable to analyze file (NullPointerException)中得到解答,具体取决于您使用的sonar-java插件的版本。