Sonar

Using local sonar instance

Either download Sonar or install with

    brew update
    brew install sonar

Create local database on MySQL

    mysql -uroot

and run

    CREATE DATABASE sonar;
    CREATE USER 'sonar'@'localhost' IDENTIFIED BY 'sonar';
    GRANT ALL PRIVILEGES ON sonar.* TO 'sonar'@'localhost';
    FLUSH PRIVILEGES;

Configure Sonar

    vi /usr/local/Cellar/sonarqube/6.3.1/libexec/conf/sonar.properties

And uncomment / set

    sonar.jdbc.username=sonar
    sonar.jdbc.password=sonar
    sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useSSL=false&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
    sonar.web.host=localhost

Run sonar

    sonar console

Access sonar locally at http://localhost:9000/ and log in with username / password = admin / admin.

Configuring Sonar for use with Maven

    <profile>
      <id>sonar</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <!-- Optional URL to server. Default value is http://localhost:9000 -->
        <sonar.host.url>http://relax:9000</sonar.host.url>
      </properties>
    </profile>

Start Sonar on restart

If you want Sonar to start on system restart :

    brew services start sonarqube

References