Sie sind auf Seite 1von 4

Installing SonarQube Server

Requirements:
Supported Platforms : Oracle JRE
Database : Microsoft SQL Server , MySQL, Oracle
Installing the Web Server
Download and unzip the latest distribution from http://www.sonarqube.org/downloads/
<install_directory> (below) refers to the path to the directory where the SonarQube distribution has
been unzipped.
Setting the access to the Database
Edit <install_directory>/conf/sonar.properties to configure the database settings. Templates are
available for every supported database. Just uncomment and configure the template as per your need.
Example for PostgreSQL
sonar.jdbc.username=sonarqube
sonar.jdbc.password=mypassword
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube

Starting the Web Server
The default port is "9000" and the context path is "/". These values can be changed in
<install_directory>/conf/sonar.properties:
sonar.properties
sonar.web.host=192.0.0.1
sonar.web.port=80
sonar.web.context=/sonar

Execute the following script to start the server:
On Windows: <install_directory>/bin/windows-x86-XX/StartSonar.bat
Where XX is 32 or 64 bit depending on operating system.

Installing the Analyzers
Installing and Configuring SonarQube Runner
Download SonarQube Runner from
http://repo1.maven.org/maven2/org/codehaus/sonar/runner/sonar-runner-dist/2.4/sonar-runner-dist-
2.4.zip

Installing and Configuring Installation
1. Uncompress 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 (database connection, server URL) by editing
<install_directory>/conf/sonar-runner.properties:
#----- Default SonarQube server
#sonar.host.url=http://localhost:9000

#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar

#----- MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;charact
erEncoding=utf8

#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE

#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor

#----- Global database settings
#sonar.jdbc.username=sonar
#sonar.jdbc.password=sonar

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:
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

Integrating SonarQube with Visual Studio
Requirements:
Download and install update for Visual Studio from here http://www.microsoft.com/en-
us/download/details.aspx?id=40764
Download and install SonarQube extension for visual studio VSSonarExtension from here
http://visualstudiogallery.msdn.microsoft.com/7fc312c3-f1ab-49f8-b286-dbf7fff37305

Analyzing projects using Sonar Runner
1. Create a configuration file in the root directory of the project: sonar-project.properties
sonar-project.properties
# Required metadata
sonar.projectKey=my:project
sonar.projectName=My project
sonar.projectVersion=1.0

# Path to the parent source code directory.
# Path is relative to the sonar-project.properties file. Replace "\" by "/"
on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory
containing
# the sonar-project.properties file.
sonar.sources=src

# Encoding of the source code
sonar.sourceEncoding=UTF-8

# Additional parameters
sonar.my.property=value

2. Run the following command from the project base directory to launch the analysis:
sonar-runner

Das könnte Ihnen auch gefallen