最近,当我尝试分析 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
链接时,将显示以下屏幕:
显然,我不想禁用插件。
此处复制了异常文本:
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$6.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$4.run(GlobalInspectionContextBase.java:241)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.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$1.run(ProgressManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl$8.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$1$1.run(PooledThreadExecutor.java:56)
有人遇到过这个问题吗?问题在哪里,我该怎么做才能解决它?
答案 0 :(得分:2)
您应该根据插件存储库中的README配置SonarQube服务器:
安装完成后,首先需要配置 与Sonar服务器的连接。这是按项目和/或完成的 模块。您可以在计算机上使用远程服务器或本地服务器。
在IDE中,转到偏好设置 - > SonarQube。
单击“添加”,输入Sonar服务器的地址和凭据(如果需要),然后单击“确定”。
答案 1 :(得分:1)
在项目设置中创建服务器但在全局设置中创建服务器时,也会抛出此错误。你必须选择&也可以在全局设置中添加服务器。