gpt4 book ai didi

java - Clojure 代码的 Sonarqube 静态代码分析

转载 作者:行者123 更新时间:2023-12-01 17:50:19 25 4
gpt4 key购买 nike

我正在使用 Sonarqube 版本 7.5.0.20543、Sonar Scanner 版本 sonar-scanner-4.2.0.1873 和 Sonar-Clojure 插件 ( https://github.com/fsantiag/sonar-clojure )

我正在尝试使用 Sonarqube 分析 Clojure 代码。我已将上述 Clojure 插件添加到 Sonar 服务器中。我正在尝试从存储代码的本地路径运行 Sonar 扫描仪。以下是我正在使用的命令:-

sonar-scanner.bat -D"sonar.projectKey=ProjectKey"-D"sonar.sources=."-D"sonar.host.url=http://localhost:9000"-D"sonar.login=xxxxxxx"

这是我运行命令时遇到的错误:–

at org.sonar.api.utils.command.CommandExecutor.execute(CommandExecutor.java:102)
at org.sonar.plugins.clojure.sensors.CommandRunner.run(CommandRunner.java:36)
at org.sonar.plugins.clojure.sensors.CommandRunner.run(CommandRunner.java:50)
at org.sonar.plugins.clojure.sensors.eastwood.EastwoodSensor.execute(EastwoodSensor.java:47)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:45)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.lambda$execute$1(SensorsExecutor.java:65)
at org.sonar.scanner.phases.SensorsExecutor.withGlobalStrategy(SensorsExecutor.java:80)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:65)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:74)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:164)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:319)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:314)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:288)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131)
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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.io.IOException: Cannot run program “lein”: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at org.sonar.api.utils.command.CommandExecutor.execute(CommandExecutor.java:74)
… 36 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.(Unknown Source)
at java.base/java.lang.ProcessImpl.start(Unknown Source)
… 39 more

还有其他我可以使用的插件吗?或者我有什么做得不正确的地方吗?

诗。我对 Sonarqube 和 Clojure 都很陌生

最佳答案

看起来您切断了异常堆栈跟踪的开头(它应该在开头说明有关“异常”的内容)。

但是,底部有一个大线索:

at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.io.IOException: Cannot run program “lein”: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at org.sonar.api.utils.command.CommandExecutor.execute(CommandExecutor.java:74)
… 36 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.(Unknown Source)

您的 SonarSource 代码正在尝试查找名为 lein 的系统程序。它显然不在系统路径上。我猜您在尝试调用 SonarQube 扫描仪时使用了 lein 错误。

我找到了一些可以帮助您调试安装的信息:

关于java - Clojure 代码的 Sonarqube 静态代码分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60809268/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com