Objective: Setup a Sonar server pointing to a PostgreSQL DB server that can be used by multiple maven clients (developers) remotely
Software:
- Sonar 2.8
- PostgreSQL server 9.2
- Maven 3.3
Prerequisite: Maven and Sonar are already installed. Project repository contains sonar specific dependencies.
Procedure:
Setup PostgreSQL DB server
- Install postgreSQL 9.2
- Use pgAdmin III to create a new Login Role
- Username: sonar
- Password: sonar
- Create a new Database ‘sonar’ having owner ‘sonar’ login role.
Point SONAR to PostgreSQL DB
- Update <sonar_home>\conf\sonar.properties
- Comment sonar.jdbc.* properties to deactivate the default embedded database (derby)
- Uncomment sonar.jdbc.* properties to use PostgreSQL
sonar.jdbc.url: jdbc:postgresql://<ip_address_of_postgresql_server>/sonar
sonar.jdbc.driverClassName: org.postgresql.Driver
sonar.jdbc.validationQuery: select 1
- Copy postgresql-9.2-1002.jdbc3.jar to <sonar_home>\extensions\jdbc-driver\postgresql
- Update <maven_home>\conf\settings.xml to add a profile for sonar
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>
jdbc:postgresql://<ip_address_of_postgresql_server>/sonar
</sonar.jdbc.url>
<sonar.jdbc.driverClassName>org.postgresql.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>
http://<ip_address_of_sonar_server>:9000
</sonar.host.url>
</properties>
</profile>
- Add IP address of machine where maven build is going to be executed to <postgresql_home>\data\pg_hba.conf
host all all <IP address of maven build machine>/32 trust