Checkstyle:自定义规则 - Eclipse插件 [英] Checkstyle: Custom Rules - Eclipse Plugin

查看:885
本文介绍了Checkstyle:自定义规则 - Eclipse插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了几个使用checkstyle API的自定义检查规则。他们使用Maven运行良好(在将新项目添加到checkstyle插件的依赖项之后)。



现在我希望这些规则被Eclipse Checkstyle插件使用。这是我在挣扎的地方。



我已经下载了示例插件项目(如建议这里 here



阅读这些链接后,我不明白下一步该怎么做。


  1. 我需要将我的项目导出为JAR吗?

  2. 如何将其插入现有的Checkstyle插件?

谢谢

解决方案

你已经有了正确的链接,最终会让你在那里。对于您的问题:


  1. 所有您的自定义检查都可以进入一个JAR文件。该JAR文件必须是Eclipse插件JAR。我可以通过将其复制到Eclipse dropins 文件夹来安装,但可能会有更优雅的方式来实现。


  2. 所以你最终得到两个插件:原来的,未修改的Eclipse-CS和你自己的插件,其中包含自定义检查。当两者都独立安装在Eclipse中时,Eclipse-CS配置对话框将提供您在Checkstyle配置中使用的自定义检查。



I have written few custom checkstyle rules using checkstyle API. They run fine using Maven (after I add the new project as a dependency to the checkstyle plugin).

Now I want these rules to be used by the Eclipse Checkstyle plugin. And this is where I am stuggling.

I've downloaded the sample plugin project (as suggested here and here).

I do not understand what to do next after reading these links.

  1. Do I need to export my project as a JAR?
  2. How do I plug it into my existing Checkstyle plugin?

Thanks

解决方案

You already have the correct links that will eventually get you there. As for your questions:

  1. All your custom checks can go into one JAR file. That JAR file must be an Eclipse plugin JAR. I simply install it by copying it to the Eclipse dropins folder, but there may be more elegant ways to do that.

  2. So you end up with two plugins: The original, unmodified Eclipse-CS, and your own plugin which contains the custom checks. When both are independently installed in Eclipse, the Eclipse-CS configuration dialog will offer your custom checks for use in Checkstyle configurations.

这篇关于Checkstyle:自定义规则 - Eclipse插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆