Checkstyle: Custom Rules - Eclipse Plugin

2019-02-19 02:42发布

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

2条回答
叼着烟拽天下
2楼-- · 2019-02-19 03:10

You can do it like following :

  1. Create plugin project and add your custom checks there.
  2. Make appropriate changes to plugin.xml, checkstyle_packages.xml.
  3. Export the project as Deployable Plug-ins and fragments (Export > Plug-in Developement)
  4. Copy the jar file to Eclipse Plugin folde, so no need to install your custom check .

You can refer this tutorial

查看更多
ゆ 、 Hurt°
3楼-- · 2019-02-19 03:13

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.

查看更多
登录 后发表回答