Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 36 Next »

Prerequisites

To create a SonarQubeplugin, you need Java 6 or later. Maven is required to compile and package the plugin.

Creating a New Plugin

The recommended way is to duplicate one of the examples located in the 'plugins' directory of the following GitHub repository: https://github.com/SonarSource/sonar-examples. If you don't know which one must be used, then select plugins/sonar-reference-plugin.

There are two ways to copy the example:

  1. if you have Git, just clone the repository
  2. if you don't have Git, download the repository at https://github.com/SonarSource/sonar-examples/zipball/master

Building and Deploying a Plugin

Simply execute:

from the root directory, for example /path/to/sonar-reference-plugin. The JAR file is generated in the 'target' directory.

Then, copy the JAR to the '$SONAR_HOME/extensions/plugin' directory and restart your SonarQubeserver.

Working on Eclipse Plugins in Eclipse

  1. clone https://github.com/SonarSource/sonar-eclipse
  2. run an initial Maven build from the command line: mvn clean install
  3. import everything into Eclipse as a Maven project (the Tycho connector should be installed automatically)
  4. in Eclipse preferences, configure a new variable in Run/Debug -> String substitution: M2_REPO = /path/to/your/local/m2/repo
  5. open and activate one of the following target platforms:
    1. If you want to work with Kepler: target-platform-e43/target-platform-e43-dev.target

    • If you want to work with Juno: target-platform-e42/target-platform-e42-dev.target
At this point everything should be green in Eclipse, and you should be able to run/debug Sonar Eclipse plugin. 

If you're working in Linux, consider using Kepler. We find it to be more stable than Juno on Linux.

Next step is: coding a plugin.

  • No labels