Create the structure
As a prerequisite to write a plugin, you are going to need to have the Java Development Kit version 5 or higher Maven version 2.0.9 or higher installed.
You can execute an archetype in order to generate the skeleton of your plugin :
[ARCHETYPE_ID] can either be 'sonar-basic-plugin-archetype' for a vanilla plugin or 'sonar-gwt-plugin-archetype' for a plugin with Google Web Toolkit extensions.
A Sonar plugin is a set of POJOs that implement one or more Sonar extension points. Those extension points are interfaces or abstract classes that model an aspect of the system and define contracts of what needs to be implemented. POJOs are then placed in a container that implements the Plugin extension point.
Sonar must then have a way to retrieve the plugin class. For this, the plugin class must be declared in the JAR manifest. Maven can handle this stuff by adding this in your pom.xml file :
A plugin is packaged in a JAR file that must be deployed into the directory $SONAR_HOME/extensions/plugins before starting the server.