尝试使用gradle 2.4和sonar-qube 5.1运行sonar-runner 2.4时出现以下错误。
15:25:17.082 ERROR - Class not found: org.apache.commons.compress.archivers.zip.ZipFile
15:25:17.210 ERROR - Class not found: org.apache.commons.compress.archivers.zip.ZipFile
15:25:17.453 ERROR - Class not found: org.apache.commons.compress.archivers.zip.ZipFile
15:25:17.459 ERROR - Class not found: org.apache.commons.httpclient.NameValuePair
15:25:17.781 ERROR - Class not found: org.apache.commons.compress.archivers.zip.ZipFile
15:25:17.840 ERROR - Unable to create symbol table for : C:\Users\srao1\IntellijWorkSpace\warehouse\trunk\lds_warehouse_base\src\com\lim\dw\phase\PhaseDirManager.java
java.lang.IllegalStateException: null
at com.google.common.base.Preconditions.checkState(Preconditions.java:129) ~[sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.java.model.AbstractTypedTree.setType(AbstractTypedTree.java:56) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.TypeAndReferenceSolver.registerType(TypeAndReferenceSolver.java:629) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.TypeAndReferenceSolver.resolveAs(TypeAndReferenceSolver.java:271) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.TypeAndReferenceSolver.resolveAs(TypeAndReferenceSolver.java:247) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.TypeAndReferenceSolver.resolveAs(TypeAndReferenceSolver.java:240) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.TypeAndReferenceSolver.visitAnnotation(TypeAndReferenceSolver.java:558) ~[java-squid-3.0.jar:na]
at org.sonar.java.model.declaration.AnnotationTreeImpl.accept(AnnotationTreeImpl.java:77) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:36) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitModifier(BaseTreeVisitor.java:328) ~[java-squid-3.0.jar:na]
at org.sonar.java.model.declaration.ModifiersTreeImpl.accept(ModifiersTreeImpl.java:91) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:47) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.TypeAndReferenceSolver.visitVariable(TypeAndReferenceSolver.java:483) ~[java-squid-3.0.jar:na]
at org.sonar.java.model.declaration.VariableTreeImpl.accept(VariableTreeImpl.java:180) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:36) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.TypeAndReferenceSolver.visitClass(TypeAndReferenceSolver.java:122) ~[java-squid-3.0.jar:na]
at org.sonar.java.model.declaration.ClassTreeImpl.accept(ClassTreeImpl.java:196) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:36) ~[java-squid-3.0.jar:na]
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitCompilationUnit(BaseTreeVisitor.java:55) ~[java-squid-3.0.jar:na]
at org.sonar.java.resolve.SemanticModel.createFor(SemanticModel.java:67) ~[java-squid-3.0.jar:na]
at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:111) ~[java-squid-3.0.jar:na]
at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:67) [sslr-core-1.20.jar:na]
at org.sonar.java.ast.AstScanner.simpleScan(AstScanner.java:107) [java-squid-3.0.jar:na]
at org.sonar.java.ast.AstScanner.scan(AstScanner.java:75) [java-squid-3.0.jar:na]
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:122) [java-squid-3.0.jar:na]
at org.sonar.java.JavaSquid.scan(JavaSquid.java:115) [java-squid-3.0.jar:na]
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:92) [sonar-java-plugin-3.0.jar:na]
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:59) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:51) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:120) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) [sonar-batch-maven-compat-5.1.jar:na]
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48) [sonar-runner-batch3140836476172153146.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_40]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_40]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_40]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_40]
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) [sonar-runner-dist-2.4.jar:na]
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [sonar-runner-dist-2.4.jar:na]
at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_40]
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [sonar-runner-dist-2.4.jar:na]
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [sonar-runner-dist-2.4.jar:na]
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [sonar-runner-dist-2.4.jar:na]
at org.sonar.runner.api.Runner.execute(Runner.java:100) [sonar-runner-dist-2.4.jar:na]
at org.sonar.runner.Main.executeTask(Main.java:70) [sonar-runner-dist-2.4.jar:na]
at org.sonar.runner.Main.execute(Main.java:59) [sonar-runner-dist-2.4.jar:na]
at org.sonar.runner.Main.main(Main.java:53) [sonar-runner-dist-2.4.jar:na]
15:25:18.396 ERROR - Class not found: org.apache.commons.compress.archivers.zip.ZipFile
15:25:18.587 ERROR - Class not found: javax.annotation.Nonnull$Checker
15:25:18.863 ERROR - Class not found: javax.annotation.Nonnull$Checker
15:25:19.122 ERROR - Class not found: org.apache.commons.compress.archivers.zip.ZipFile
15:25:19.284 ERROR - Class not found: org.apache.commons.compress.archivers.zip.ZipFile
15:25:19.340 INFO - Java Main Files AST scan done: 3496 ms
sonar-java plugin in version 2.9.1解决了同样的问题。这个问题是在声纳版本2.4中修复的,还是我遗漏了文件中的内容?
答案 0 :(得分:2)
您应该将安装在SonarQube服务器中的SonarQube Java插件更新到最新版本。我还建议您从Gradle sonarRunner插件迁移到使用新的Gradle SonarQube插件。