We had a dream : mvn sonar:sonar

by olivier gaudin|

    About a year ago we started to dream about the possibility to launch a full quality analysis on any Maven projects, with no configuration by simply running a simple and easy to remember command. Last week, when the Sonar maven plugin joined the Codehaus Mojo project, this dream became reality from Sonar 1.8 onwards.

    Joining this project presents several advantages to Sonar but the main one is definitely the step toward simplicity. Indeed, the old way to launch a quality analysis was to execute the maven command "mvn org.codehaus.sonar:sonar-maven-goal:X.Y:sonar", it now becomes "mvn sonar:sonar". No need to carry anymore the Sonar web server version, the Sonar Maven plugin groupId, artifactId, ... simply launch "mvn sonar:sonar" !

    This announce is a good opportunity to explain further the way the Sonar maven plugin operates. In fact, this plugin acts as a very light bootstrap mechanism whose only responsibility is to download all the business logic from the Sonar web server and execute it. Indeed, a Sonar web server embeds a Maven repository which exposes to the Maven plugin all the business logic. That is the reason why deploying a new plugin (set of extensions) in Sonar only consists of copying a jar file on the server, regardless of where the contained extensions are going to be executed : Maven or web server side. As all this leverages the Maven dependency mechanism, it is very stable and reliable.

    Here is a simple diagram to better understand the mechanism :


    Since dreaming is almost as important as breathing, we obviously do now have a new dream : being able to quickly launch a Sonar web server instance using "mvn sonar:start" with no download or installation required. This command line would be very useful for a quick project analysis, evaluation purpose or during the development of a Sonar plugin.