简体   繁体   English

使用自定义FindBugs插件扩展SonarQube FindBugs插件

[英]Extending SonarQube FindBugs plugin with custom FindBugs plugin

We created a custom plugin for FindBugs (for clarity: this is a findbugs-plugin, not a sonar-plugin) and we want to extend the FindBugs sonar-plugin with our custom findbugs-plugin. 我们为FindBugs创建了一个自定义插件(为了清晰起见:这是一个findbugs-plugin,而不是一个声纳插件),我们想用我们的自定义findbugs-plugin扩展FindBugs声纳插件。

Currently we use SonarQube 5.1 with the FindBugs sonar-plugin 3.2. 目前我们使用SonarQube 5.1和FindBugs声纳插件3.2。

Because our custom findbugs-plugin is a valid plugin for FindBugs, we thought that the most straightforward way to activate it is to use the plugin system of the FindBugs instance from our existing sonar-plugin but we were not able to find how to activate our findbugs-plugin this way. 因为我们的自定义findbugs-plugin是FindBugs的有效插件,我们认为最直接的激活方法是使用现有声纳插件中的FindBugs实例的插件系统,但我们无法找到如何激活我们的findbugs-plugin这样。

We also tried to create a rules.xml and place our jar in sonar_home/extensions/rules/findbugs as described in https://jira.sonarsource.com/browse/SONAR-1481 but this does not seem to work with the FindBugs sonar-plugin version we are using. 我们还试图创建一个rules.xml并将我们的jar放在sonar_home / extensions / rules / findbugs中,如https://jira.sonarsource.com/browse/SONAR-1481中所述,但这似乎不适用于FindBugs声纳-plugin我们正在使用的版本。

What is the proper way to configure our version of SonarQube to pick up our custom FindBugs plugin? 配置我们的SonarQube版本以获取我们的自定义FindBugs插件的正确方法是什么? What steps do we need to take? 我们需要采取哪些措施?

Your choices are forking the SonarQube FindBugs plugin and adding your rules alongside the Find Security Bugs rules (see this commit ), or creating a new plugin similar to how Find Security Bugs was handled before it was rolled into the FindBugs plugin. 您的选择是分叉SonarQube FindBugs插件并添加规则以及Find Security Bugs规则(请参阅此提交 ),或者创建一个新的插件,类似于Find Security Bugs在进入FindBugs插件之前的处理方式

In either case, you'll list your jar as a dependency in the pom.xml, provide the rules.xml you've already created, and add a repository definition . 在任何一种情况下,您都会将您的jar列为pom.xml中的依赖项,提供您已创建的rules.xml,并添加存储库定义

If you go the stand-alone route, which is probably better, you'll need to 如果你走独立路线,这可能更好,你需要

  1. wait for a bug fix in 5.2 等待5.2中的错误修复
  2. use the FindBugs repository key. 使用FindBugs存储库密钥。 See the 'before' side of this commit . 请参阅此提交的“之前”一侧。
  3. provide the needed basic plugin plumbing 提供所需的基本插件管道

EDIT: edited to add commit links & expand on requirements for stand-alone route. 编辑:编辑以添加提交链接并扩展独立路由的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM