Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

bitnot/HOWTOs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Quick start SonarQube on Win-x86 machine with MS SQL Server Express (for ASP.NET project)

DISCLAIMER: I am not responsible for anything. Read the script before running it. Use it on your own risk.

  1. Installation

Run init.bat. This will create following important files and folders:

.
|--download
|
|--jb-commandline
|	|--inspectcode.exe
|
|--sonar-runner-2.4
|	|--bin
|	|	|--sonar-runner.bat
|	|--conf
|		|--sonar-runner.properties
|
|--sonarqube-4.3
	|--bin
	|	|--windows-x86-32
	|		|--StartSonar.bat
	|--conf
	|	|--sonar.properties
	|--extensions
	 	|--jdbc-driver
	 	|	|--mssql
	 	|		|--sqljdbc4.jar
	 	|--plugins
	 		|--sonar-csharp-plugin-3.0.jar
	 		|--sonar-javascript-plugin-1.6.jar
	 		|--sonar-resharper-plugin-1.0.jar
	 		|--sonar-stylecop-plugin-1.0.jar
	 		|--sonar-visual-studio-plugin-1.0.jar
	 		|--sonar-web-plugin-2.2.jar
	 		|--sonar-xml-plugin-1.1.jar

  1. Database configuration

Create Sonar database on your MS SQL Server

USE master;
GO
CREATE DATABASE sonar;
GO

Add user sonar/sonar and grant permissions

CREATE LOGIN sonar 
    WITH PASSWORD = 'sonar';	
USE sonar;
GO
CREATE USER sonar FOR LOGIN sonar 
    WITH DEFAULT_SCHEMA = dbo;	
GO
EXEC sp_addrolemember 'db_owner', 'sonar';
GO

Make sure to change default login and password

Edit sonarqube-4.3/conf/sonar.properties

Comment out H2 related lines:

#sonar.jdbc.url=jdbc:h2:tcp://localhost:9092/sonar

Change "Microsoft SQLServer" section and modify connection string:

sonar.jdbc.url: jdbc:sqlserver://localhost;databaseName=sonar;instanceName=SQLEXPRESS;selectMethod=cursor;
sonar.jdbc.driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
sonar.jdbc.validationQuery: select 1
sonar.jdbc.dialect= mssql

Edit sonar-runner-2.4/conf/sonar-runner.properties

Change "Microsoft SQLServer" section and modify connection string:

sonar.jdbc.url: jdbc:sqlserver://localhost;databaseName=sonar;instanceName=SQLEXPRESS;selectMethod=cursor;
sonar.jdbc.driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
sonar.jdbc.validationQuery: select 1
sonar.jdbc.dialect= mssql

Change "Global database settings" section

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
  1. Sonar configuration

Open cmd and navigate to current directory

Run _sonar-runner-2.4/bin/windows-x86-32/StartSonar.bat -X

Examine errors (if there's any) and deal with them

Open http://localhost:9000

Log in as admin/admin

Change default password

Configure paths for external tools

TODO...

  1. Project Configuration

Add sonar-project.properties one level up the .sln file

sonar.projectKey=org.company.projectname
sonar.projectName=Project Name
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8

# Enable the Visual Studio bootstrapper
sonar.visualstudio.enable=true

# This property is set because it is required by the SonarQube Runner.
# But it is not taken into account because the location of the source
# code is retrieved from the .sln and .csproj files.
# Do not set it to "." as it may result in unexpected behaviour 
sonar.sources=src
sonar.exclusions=src/packages/**, **/_ReSharper.**, **/bin/**, **/obj/**

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages