Pages

08 June, 2012

Sonar Setup...Instructions(MySql)

 Step By Step Procedure to Configure Sonar for MYSQL:

Please follow the link to configure the Sonar with MySql:

http://docs.codehaus.org/display/SONAR/Installing+Sonar

Step1:Download Sonar 2.11 From Website

Step2: Copy The Folder and Extract the Folder

Step3: Down Load and Install  MYSQL(5.1) server

And create the database for the same.(for creating sample database please click https://github.com/SonarSource/sonar/blob/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql)

Step4:    In D:/sonar-2.11\conf\sonar.properties file 
Uncomment below code: For MySql

 sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
sonar.jdbc.driverClassName: com.mysql.jdbc.Driver
sonar.jdbc.validationQuery: select 1


Then Start the Sonar and check the log file:

to Start the Sonar:

D:/sonar-2.11\bin\windows-x86-32/StartSonar.bat

run the StartSonar.bat from console.

And also copy the extensions folder with customized rules.xml
under the D:\sonar-2.11 directory(overwrite the extension folder)

Then........

Download the sonar-runner-1.3 form WebSite

Copy the sonar-runner-1.3 zip folder and extract the same.

Then Edit the D:\sonar-runner-1.3\conf\sonar-runner.properties

i.e Uncomment the MySql code.

And Create the sonar-project.properties file and put this file under D:\sonar-runner-1.3\bin directory.



D:\sonar-2.11\conf\sonar.properties:

#-------------------------------------------------------- # 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 # Apache mod_jk connector. Supported only in standalone mode. # Uncomment to activate AJP13 connector. #sonar.ajp13.port: 8009 #----------------------------------------------------------------------- # DATABASE # # IMPORTANT : the embedded database Derby 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 Derby # Note : it does accept connections from remote hosts, so the # sonar server and the maven plugin must be executed on the same host. # Comment the following lines to deactivate the default embedded database. #sonar.jdbc.url: jdbc:derby://localhost:1527/sonar;create=true #sonar.jdbc.driverClassName: org.apache.derby.jdbc.ClientDriver #sonar.jdbc.validationQuery: values(1) # directory containing Derby database files. By default it's the /data directory in the sonar installation. #sonar.embeddedDatabase.dataDir: # derby embedded database server listening port, defaults to 1527 #sonar.derby.drda.portNumber: 1527 # uncomment to accept connections from remote hosts. Ba default it only accepts localhost connections. #sonar.derby.drda.host: 0.0.0.0 #----- MySQL 5.x/6.x # Comment the embedded database and uncomment the following properties to use MySQL. The validation query is optional. #sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 #sonar.jdbc.driverClassName: com.mysql.jdbc.Driver #sonar.jdbc.validationQuery: select 1 sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 sonar.jdbc.driverClassName: com.mysql.jdbc.Driver sonar.jdbc.validationQuery: select 1 #----- 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/enterprise-edition/jdbc-112010-090769.html # - Copy the driver to the directory extensions/jdbc-driver/oracle/ # - Comment the embedded database and uncomment the following properties. The validation query is optional. # #sonar.jdbc.url: jdbc:oracle:thin:@localhost/XE #sonar.jdbc.driverClassName: oracle.jdbc.driver.OracleDriver #sonar.jdbc.validationQuery: select 1 from dual # Uncomment the following property if multiple Sonar schemas are installed on the same server # (for example with different versions). # In that case, use the same property during project analysis (-Dsonar.hibernate.default_schema=<schema>) #sonar.hibernate.default_schema: sonar #----- PostgreSQL 8.x, 9.x # Uncomment the following properties to use PostgreSQL. The validation query is optional. #sonar.jdbc.url: jdbc:postgresql://localhost/sonar #sonar.jdbc.driverClassName: org.postgresql.Driver #sonar.jdbc.validationQuery: select 1 # If the PostgreSql database contains several schemas, the following property must define the schema to be used #sonar.jdbc.postgreSearchPath: public #----- Microsoft SQLServer # The Jtds open source driver is available in extensions/jdbc-driver/mssql. More details on http://jtds.sourceforge.net # The validation query is optional. #sonar.jdbc.url: jdbc:jtds:sqlserver://localhost;databaseName=SONAR;SelectMethod=Cursor #sonar.jdbc.driverClassName: net.sourceforge.jtds.jdbc.Driver #sonar.jdbc.validationQuery: select 1 #----- Connection pool settings sonar.jdbc.maxActive: 25 sonar.jdbc.maxIdle: 5 sonar.jdbc.minIdle: 2 sonar.jdbc.maxWait: 5000 sonar.jdbc.minEvictableIdleTimeMillis: 600000 sonar.jdbc.timeBetweenEvictionRunsMillis: 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



sonar-project.properties:

# required metadata sonar.projectKey=my2:project sonar.projectName=AQM_LIB sonar.projectVersion=1.0   # path to source directories (required) #sources=D:\\Projects\\Cloud-Migration-POC\\Cust-Supp-Artf\\AQMLatest_SourceCode\\AQM_LIB_5.0 sources=D:\\WorkSpace\\GWTProj\\cloud_migration\\aqm_lib\\src\\java #D:\WorkSpace\GWTProj\cloud_migration\aqm_lib   # path to test source directories (optional) #tests=testDir1,testDir2   # path to project binaries (optional), for example directory of Java bytecode #binaries=binDir   # optional comma-separated list of paths to libraries. Only path to JAR file and path to directory of classes are supported. #libraries=path/to/library.jar,path/to/classes/dir     # Uncomment those lines if some features of java 5 or java 6 like annotations, enum, ...  # are used in the source code to be analysed sonar.java.source=1.5 sonar.java.target=1.5     # Uncomment this line to analyse a project which is not a java project.  # The value of the property must be the key of the language. #sonar.language=cobol   # Advanced parameters my.property=value

1.Run Sonar And
2.Then run the sonar-runner-1.3\bin\sonar-runner.bat  from console.
3.type http://localhost:9000 in browser
and click on configuration....


D:\SANA_S\Soft\sonar-runner-1.3\conf\sonar-runner.properties file:

#----- 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 #sources=src/main/java #tests=src/test/java #binaries=target/classes sonar.sourceEncoding=UTF-8


Related Sites:

BY

SANA


7 comments:

  1. In my case i am Oracle DataBase..

    #sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE
    #sonar.jdbc.driver=oracle.jdbc.driver.OracleDriver

    I un commneted above code

    ReplyDelete
  2. Everything is very open with a clear explanation of the challenges.
    It was really informative. Your site is useful.

    Thanks for sharing!

    Stop by my web site CrossFit shoes

    ReplyDelete
  3. When someone writes an article he/she retains the image of a user in his/her
    brain that how a user can understand it. So that's why this post is amazing. Thanks!

    Also visit my weblog ... garage rubber flooring

    ReplyDelete
  4. I love what you guys
    are up too. This sort
    of clever work and coverage!

    Keep up the very good works guys I've added you guys to my own blogroll.

    my web-site :: CrossFit flooring

    ReplyDelete
  5. Hi there, I log on to your new stuff on a regular basis. Your
    writing style is witty, keep it up!

    Have a look at my blog - low interest rate home loans ()

    ReplyDelete
  6. Hello there! This post couldn't be written any better! Looking through this post reminds me of my previous roommate! He continually kept preaching about this. I will send this post to him. Fairly certain he's going to have a very good read.
    Thank you for sharing!

    Have a look at my web page best dating sites

    ReplyDelete