RSS

Sonar Upgradation from 3.0.1 to 3.4.1

21 Apr

Hi folks,

This post is the continuation of my earlier post on Sonar Setup.

Check my earlier post posted on  Mar 14th 2013 on Sonar Setup or use the search functionality in the blog.

Recently i have upgraded the sonar version from 3.0.1 to 3.4.1.

I have faced some challenges when upgrading the version.

My intension to share here is to save developers time for some extent.

Here is the detailed post.

In 3.4.1 version,

–> Database is upgraded from derby to H2
–> To support this, we have to add few supported maven dependencies jar files in POM.xml file.

Here is the elaborated post how to do the Sonar setup for your web application.

Just follow the below steps to upgrade sonar version successfully.

Step – 1. download sonar 3.4.1 from this link (http://www.sonarsource.org/downloads/)
Step – 2. Update the pom.xml file with the below content

pom.xml
<project xmlns=”http://maven.apache.org/POM/4.0.0&#8243;
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”&gt;
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-check-api</artifactId>
<name>your project name</name>
<version>1.0</version>
<build>
<sourceDirectory>source code path (path for java classes directory)</sourceDirectory>
<outputDirectory>path for classes directory</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<excludes>
<exclude>**/*.*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.170</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.1.1</version>
</dependency>
</dependencies>
<properties>
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
</properties>
</project>

Note: In the above configuration, modify source-directory and output-directory value path to your local machine path.

Step-3

Setting.xml

<settings>
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username></username>
<password></password>
<host>http.proxy.com</host>
<port>8000</port>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
<pluginGroups>
<pluginGroup>com.fortify.ps.maven.plugin</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>
jdbc:h2:tcp://localhost:9092/sonar
</sonar.jdbc.url>
<sonar.jdbc.driver>
org.h2.Driver
</sonar.jdbc.driver>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<!– SERVER ON A REMOTE HOST –>
<sonar.host.url>http://localhost:9000/</sonar.host.url&gt;
</properties>
</profile>
</profiles>
</settings>

Happy Coding!!

Stay tuned to know more updates.

Have a nice day 🙂

Advertisements
 
Leave a comment

Posted by on April 21, 2013 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: