"IllegalArgumentException" 在 SonarQube 社区插件中

"IllegalArgumentException" in SonarQube Community plugin

最近,当我尝试在 Android Studio (Analyze > Inspect Code) 中分析代码时,我总是得到这个错误:

11:35:28 IllegalArgumentException: Argument for @NotNull parameter 'sonarServerName' of org/intellij/sonar/persistence/SonarServers.get must not be null

在其他项目中它工作正常。单击 IllegalArgumentException link 时,将显示此屏幕:​​

显然,我不想禁用插件。

此处复制的异常文本:

Argument for @NotNull parameter 'sonarServerName' of org/intellij/sonar/persistence/SonarServers.get must not be null
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'sonarServerName' of org/intellij/sonar/persistence/SonarServers.get must not be null
    at org.intellij.sonar.persistence.SonarServers.get(SonarServers.java)
    at org.intellij.sonar.analysis.DownloadIssuesTask.from(DownloadIssuesTask.java:53)
    at org.intellij.sonar.analysis.SonarQubeInspectionContext.performPreRunActivities(SonarQubeInspectionContext.java:143)
    at com.intellij.codeInspection.ex.GlobalInspectionContextBase.initializeTools(GlobalInspectionContextBase.java:340)
    at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.runTools(GlobalInspectionContextImpl.java:339)
    at com.intellij.codeInspection.ex.GlobalInspectionContextBase.run(GlobalInspectionContextBase.java:283)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:452)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:449)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.codeInspection.ex.GlobalInspectionContextBase.performInspectionsWithProgress(GlobalInspectionContextBase.java:280)
    at com.intellij.codeInspection.ex.GlobalInspectionContextBase.run(GlobalInspectionContextBase.java:241)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
    at com.intellij.openapi.progress.impl.CoreProgressManager.run(CoreProgressManager.java:152)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:452)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.run(ProgressManagerImpl.java:126)
    at com.intellij.openapi.application.impl.ApplicationImpl.run(ApplicationImpl.java:405)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jetbrains.ide.PooledThreadExecutor.run(PooledThreadExecutor.java:56)

有人遇到过这个问题吗?问题出在哪里,我该如何解决?

您应该配置 SonarQube 服务器以根据插件存储库中的 README 使用:

After the installation, you first of all need to configure the connection to your Sonar server. This is done per project and/ or module. You can use a remote server or a local one on your machine.

In your IDE go to Preferences -> SonarQube.

Click Add, enter the address of your Sonar server and the credentials (if needed) and click OK.

当您在项目设置中创建服务器而不是在全局设置中创建服务器时,也会抛出此错误。您还必须 select 并在全局设置中添加服务器。