在 Eclipse 中使用 SonarQube

2022-01-17 00:00:00 sonarqube eclipse

我刚刚在 Eclipse 中安装了 SonarQube,但我不知道如何使用它:

I just installed SonarQube in Eclipse, but I don't know how to use it :

这里 它说:将项目链接到 Sonar 服务器

Here It said: Link projects to Sonar server

什么是服务器?我们是否应该在其他地方创建另一个与 Eclipse 中的项目同名的项目?

What is the server? Should we create another project somewhere else with the same name as the project in Eclipse?

这真的很令人困惑,如果有人可以通过一个小例子提供帮助,我将不胜感激.

It's really confusing, I will appreciate if someone could help by a small example.

推荐答案

为了能够使用 Sonar Eclipse,您首先需要安装 Sonar 服务器 5.1 或更早版本,如下所述:http://docs.sonarqube.org/display/SONAR/SonarQube+in+Eclipse

To be able to use Sonar Eclipse, you first need to install a Sonar server 5.1 or older as described here: http://docs.sonarqube.org/display/SONAR/SonarQube+in+Eclipse

然后,您必须对您的项目进行第一次分析(在 Eclipse 之外),以便在 Sonar 服务器中引用它.请参阅 http://docs.sonarqube.org/display/SONAR/Analyzing+Source+代码

Then, you will have to run a first analysis (out of Eclipse) of your project to have it referenced in the Sonar server. See http://docs.sonarqube.org/display/SONAR/Analyzing+Source+Code

完成这两个步骤后,一旦您将本地项目与 Sonar 服务器相关联,您就可以直接在 Eclipse 中运行分析.

After those 2 steps, then you'll be able to run analyses directly within Eclipse once you have associated your local project with the Sonar server.

更新:Sonar 5.2+ 不再支持 sonar eclipse 插件,而是支持 sonarlint.不幸的是,sonarlint 没有自定义选项.

UPDATE: Sonar 5.2+ is no longer supporting sonar eclipse plugin in favor of sonarlint. Unfortunately sonarlint has no customization options.

我们将在即将发布的版本中提供此功能,可能会通过需要将 SonarLint 与现有的 SonarQube 服务器连接"实例.

We will make this feature available in upcoming versions, probably by requiring to "connect" SonarLint with an existing SonarQube server instance.

相关文章