3

I'd like to write my own Check using CheckStyle and incorporate this in my ant build.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

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

I found the documentation you're pointing to but I still have questions. I know the check I would like to create does not exist. Do I still need the properties file in my taskdef? Can you write out a working example?
You might be better off writing the task as a java ant task than a checkstyle task, as it more closely mimics the provided example.
Thanks for the response Edwin. Have you done this before? Can you write up an answer so I can try it and accept it?
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.