Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
HTML
<div class="table-wrap"><table style="line-height: 1.4285715;" class="confluenceTable"><tbody><tr><td class="highlight-grey confluenceTd" data-highlight-colour="grey">By <a target="_top" href="http://www.sonarsource.com">SonarSource</a> &#8211; GNU LGPL 3 &#8211;
<a target="_top" href="http://jira.sonarsource.com/browse/SQSCANNER">Issue Tracker</a> &#8211;
<a target="_top" href="https://github.com/Sonarsource/sonar-scanner-cli">Sources</a>
<br>
<div>
    <div style="padding-top:10px;padding-bottom:5px">
    <span style="font-size:larger;"><strong>SonarQube Scanner 2.5<5.1</strong></span>
     &#8211; Compatible with SonarQube 4.5.4+ (LTS)
    <br>
    <a target="_top" href="https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.5.1.zip">Download</a>
    </div> 
</div> 
</div> </td></tr></tbody></table></div>

...

Prerequisites

  • SonarQube is already installed
  • At least the minimal version of Java supported by your SonarQube server is in use
  • The language plugins for each of the languages you wish to analyze are installed
  • You have read Analyzing Code Source

Installation

  1. Expand the downloaded file into the directory of your choice. We'll refer to it as <install_directory> in the next steps.
     
  2. Update the global settings (server URL) by editing <install_directory>/conf/sonar-runner.properties:

    Code Block
    languagebash
    #----- Default SonarQube server
    #sonar.host.url=http://localhost:9000
    
  3. Create a new SONAR_RUNNER_HOME environment variable set to <install_directory>.
     
  4. Add the <install_directory>/bin directory to your path.
     
  5. You can check the basic installation by opening a new shell and executing the command sonar-runner -h (on Windows platform the command is sonar-runner.bat -h) . You should get a message like this:

    Code Block
    usage: sonar-runner [options]
     
    Options:
     -D,--define <arg>     Define property
     -e,--errors           Produce execution error messages
     -h,--help             Display help information
     -v,--version          Display version information
     -X,--debug            Produce execution debug output

...

Code Block
languagenone
sonar-runner

Include Page
SONAR:Include - Analysis - Security
SONAR:Include - Analysis - Security

Project Samples

To help you get started, simple project samples are available for most languages on github. They can be browsed or downloaded. You'll find them filed under projects/languages.

...

The root folder of the project to analyze can be set through the sonar.projectBaseDir property since SonarQube Scanner 2.4 (was previously project.home). This folder must contain a sonar-project.properties file if the mandatory properties (like sonar.projectKey) are not specified on the command line.

Additional analysis parameters can be defined in this project configuration file or through command-line parameters. 

...

For more, see the listing of analysis parameters.

Troubleshooting

Note

If you get a Java heap space error or java.lang.OutOfMemoryError, you can increase the memory via the SONAR_RUNNER_OPTS environment variable:

Code Block
languagenone
export SONAR_RUNNER_OPTS="-Xmx512m -XX:MaxPermSize=128m"

On Windows environments, avoid the double-quotes, since they get misinterpreted and combine the two parameters into a single one.

Code Block
languagenone
set SONAR_RUNNER_OPTS=-Xmx512m -XX:MaxPermSize=128m