开发者

Java CheckStyle usage

开发者 https://www.devze.com 2023-03-18 10:19 出处:网络
I\'d like to write my own Check using CheckStyle and incorporate this in my ant b开发者_Python百科uild.xml.The documentation doesn\'t seem to provide detailed instructions on how to do so.Does anyone

I'd like to write my own Check using CheckStyle and incorporate this in my ant b开发者_Python百科uild.xml. The documentation doesn't seem to provide detailed instructions on how to do so. Does anyone have experience doing this, and if so, can they provide a HelloWorldCheck example along with the changes one needs in their build.xml to create a target that runs this?

Here is a reference to my question on their sourceforge mail dist


Here is an example for writing an ant task to run checkstyle.

You should look at the available checks to see if there is already a check that fulfills your requirement. If not, the following guide should have enough information to get you started.


Below is a 'HelloWorld' style example although it is written for Maven and not Ant.

For an Ant build you would build the BlundellCheckstyle as a jar and package it in your /libs/ folder. The configuration is just the same as below and the command to run checkstyle from the command line would work a treat. Using the AntTask example it looks pretty much like the Maven config and wouldn't take much to change it.

http://blog.blundell-apps.com/create-your-own-checkstyle-check/

and source code here:

https://github.com/blundell/CreateYourOwnCheckStyleCheck

0

精彩评论

暂无评论...
验证码 换一张
取 消