Sie sind auf Seite 1von 5

Pre requirements Tomcat, mysql, java start tomcat Install Sonar Download sonar http://dist.sonar.codehaus.org/sonar-3.5.1.

zip Unzip the zip file. Create mysql database


# # Create Sonar database and user. # # Command: mysql -u root -p < create_database.sql # CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'sonar' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar'; FLUSH PRIVILEGES;

To drop mysql db
# # Drop Sonar database and user. # # Command: mysql -u root -p < drop_database.sql # DROP DATABASE IF EXISTS sonar; DROP USER 'sonar'@'localhost'; DROP USER 'sonar'@'%';

Configure sonar.properties Sample file


#-------------------------------------------------------# This file must contain only ISO 8859-1 characters # see http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(j ava.io.InputStream) # # To use an environment variable, use the following syntax : $ {env:NAME_OF_ENV_VARIABLE} # For example : # sonar.jdbc.url: ${env:SONAR_JDBC_URL} # # # See also the file conf/wrapper.conf for JVM advanced settings #---------------------------------------------------------

#--------------------------------------------------------# WEB SETTINGS - STANDALONE MODE ONLY # These settings are ignored when the war file is deployed to a JEE server. #--------------------------------------------------------# Listen host/port and context path (for example / or /sonar). Default values are 0.0.0.0:9000/. #sonar.web.host: 0.0.0.0 #sonar.web.port: 9000 #sonar.web.context: / # Log HTTP requests. Deactivated by default. #sonar.web.jettyRequestLogs: ../../logs/jetty-yyyy_mm_dd.request.log #sonar.web.jetty.threads.min: 5 #sonar.web.jetty.threads.max: 50 #sonar.web.jetty.threads.low: 10 #----------------------------------------------------------------------# DATABASE # # IMPORTANT : the embedded database H2 is used by default. # It is recommended for tests only. Please use an external database # for production environment (MySQL, Oracle, Postgresql, SQLServer) # #----------------------------------------------------------------------#----- Credentials # Permissions to create tables and indexes must be granted to JDBC user. # The schema must be created first. sonar.jdbc.username: sonar sonar.jdbc.password: sonar #----- Embedded database H2 # Note : it does not accept connections from remote hosts, so the # sonar server and the maven plugin must be executed on the same host. # Comment the following line to deactivate the default embedded database. #sonar.jdbc.url: jdbc:h2:tcp://localhost:9092/sonar #sonar.jdbc.driverClassName: org.h2.Driver # directory containing H2 database files. By default it's the /data directory in the sonar installation. #sonar.embeddedDatabase.dataDir: # H2 embedded database server listening port, defaults to 9092 #sonar.embeddedDatabase.port: 9092 #----- MySQL 5.x # Comment the embedded database and uncomment the following line to use MySQL sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar? useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true # Optional properties sonar.jdbc.driverClassName: com.mysql.jdbc.Driver

#----- Oracle 10g/11g # To connect to Oracle database : # # - It's recommended to use the latest version of the JDBC driver (either ojdbc6.jar for Java 6 or ojdbc5.jar for Java 5). # Download it in http://www.oracle.com/technetwork/database/enterpriseedition/jdbc-112010-090769.html # - Copy the driver to the directory extensions/jdbc-driver/oracle/ # - Comment the embedded database and uncomment the following line : #sonar.jdbc.url: jdbc:oracle:thin:@localhost/XE # Optional properties #sonar.jdbc.driverClassName: oracle.jdbc.OracleDriver

# Uncomment the following property if the Oracle account has permissions to access multiple schemas, # for example sonar schemas with different versions. In that case, use the same property during project analysis # (-Dsonar.jdbc.schema=<schema>) # The schema is case-sensitive. #sonar.jdbc.schema: sonar #----- PostgreSQL 8.x/9.x # Comment the embedded database and uncomment the following property to use PostgreSQL #sonar.jdbc.url: jdbc:postgresql://localhost/sonar # Optional properties #sonar.jdbc.driverClassName: org.postgresql.Driver

# Uncomment the following property if the PostgreSQL account has permissions to access multiple schemas, # for example sonar schemas with different versions. In that case, use the same property during project analysis # (-Dsonar.jdbc.schema=<schema>) #sonar.jdbc.schema: public #----- Microsoft SQLServer # The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on http://jtds.sourceforge.net #sonar.jdbc.url: jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor # Optional properties #sonar.jdbc.driverClassName: #----- Connection pool settings sonar.jdbc.maxActive: sonar.jdbc.maxIdle: sonar.jdbc.minIdle: sonar.jdbc.maxWait: sonar.jdbc.minEvictableIdleTimeMillis: sonar.jdbc.timeBetweenEvictionRunsMillis: net.sourceforge.jtds.jdbc.Driver

20 5 2 5000 600000 30000

#--------------------------------------------------------# UPDATE CENTER #--------------------------------------------------------# The Update Center requires an internet connection to request http://update.sonarsource.org # It is activated by default: sonar.updatecenter.activate=true # HTTP proxy (default none) #http.proxyHost= #http.proxyPort= # NT domain name if NTLM proxy is used #http.auth.ntlm.domain= # SOCKS proxy (default none) #socksProxyHost= #socksProxyPort= # proxy authentication. The 2 following properties are used for HTTP and SOCKS proxies. #http.proxyUser= #http.proxyPassword= #--------------------------------------------------------# NOTIFICATIONS #--------------------------------------------------------# Delay (in seconds) between processing of notification queue sonar.notifications.delay=60

cd [sonar_install_folder]/bin/[os_specific_directory]/ sudo ./sonar.sh start http://localhost:9000/setup Install plug-ins for as required http://localhost:9000/updatecenter php, javascript etc... Install Sonar Runner from Jenkins [jenkin_server]:8080/jenkins/configure Or from http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+Sonar+Runner PHP support sonar-runner 2 in the time preparing the doc. sample sonar-runner.properties
#----- Default Sonar server sonar.host.url=http://localhost:9000

#----- PostgreSQL #sonar.jdbc.url=jdbc:postgresql://localhost/sonar #sonar.jdbc.driver=org.postgresql.Driver #----- MySQL sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar? useUnicode=true&amp;characterEncoding=utf8 sonar.jdbc.driver=com.mysql.jdbc.Driver #----- Oracle #sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE #sonar.jdbc.driver=oracle.jdbc.driver.OracleDriver #----- Global database settings sonar.jdbc.username=sonar sonar.jdbc.password=sonar #----- Default directory layout #sonar.sources=src/main/java #sonar.tests=src/test/java #sonar.binaries=target/classes #----- Default source code encoding #sonar.sourceEncoding=UTF-8 sonar.login=admin sonar.password=admin

Prepare build server for PHP http://docs.codehaus.org/display/SONAR/Installing+PHP+Environment


sudo pear pear sudo sudo sudo sudo pear pear apt-get install php5-xsl channel-discover nikic.github.com/pear install channel://nikic.github.com/pear/PHPParser-0.9.2 pear install phpunit/PHP_Timer pear install ezc/ConsoleTools pear install theseer/DirectoryScanner pear install theseer/fDOMDocument config-set auto_discover 1 install pear.phpqatools.org/phpqatools pear.netpirates.net/phpDox

Das könnte Ihnen auch gefallen