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).
No
You can do it like following :
You can refer this tutorial