Skip to content

Instantly share code, notes, and snippets.

@iisti
Forked from marek-panek/SonarQubeConfig.txt
Created April 30, 2024 08:08

Revisions

  1. @marek-panek marek-panek renamed this gist Nov 18, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @marek-panek marek-panek created this gist Nov 18, 2017.
    28 changes: 28 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    1. In PostgreSQL database

    1.1 Create user
    create user <user_name> with password '<password>';

    1.2 Create database
    create database <db_name> with owner <user_name> encoding 'UTF8';

    2. Edit <sonar_install_dir>/conf/sonar.properties

    sonar.jdbc.username=<user_name>
    sonar.jdbc.password=<password>
    sonar.jdbc.url=jdbc:postgresql://localhost/<db_name>
    sonar.web.host=0.0.0.0

    # Web context. When set, it must start with forward slash (for example /sonarqube).
    sonar.web.context=/sonarqube
    # TCP port for incoming HTTP connections. Default value is 9000.
    sonar.web.port=9999

    3. Open port
    sudo iptables -A INPUT -p tcp --dport 9999 -j ACCEPT

    4. Run SonarQube with <sonar_install_dir>/<so_env>/bin/sonar.sh
    5. Login as admin and generate token
    6. You can use it with maven:
    mvn sonar:sonar -Dsonar.host.url=http://<host>:<port>/<web_context> -Dsonar.login=<generated_token>
    To exclude for example JS files add -Dsonar.exclusions=**/*.js to the above command.