Step by step setup of Sonar Qube :

  1. Download Sonar Qube (ex: sonarqube-6.7)
  2. Download Sonar Scanner (ex: sonar-scanner-cli-3.0.3.778-windows)
  3. Set Java path for sonar qube by setting Java path in wrapper.java.command  property in the <SonarQube_Path>\config\wrapper.conf file

  1. Add project details in to <Sonar_Scanner_Path>/conf/sonar-scanner.properties
    1. sonar.host.url=http://localhost:9000
    2. sonar.sourceEncoding=UTF-8
    3. sonar.projectKey=project_name:app_name
    4. sonar.projectName=PROJECT_NAME
    5. sonar.projectVersion=1.0
    6. sonar.sourceEncoding=UTF-8
    7. sonar.modules=module1
    8. sonar.sources=src
    9. module1.sonar.projectName=module1
  2. Extract the custom jar to convert the metadata into JS in any path (say: to <Sonar_Scanner_Path>\jar\SourceCode_Extract_V3)
  3. To get above custom jar , mail me at manikandaan.k@gmail.com
  4. Say the source code to be covered by sonar is at the path : C:/mani/dev/amx-peru/om/drop2/sprint_3/07-JAVA/core/metadata/
  5. Create empty folder structure at tha path <Sonar_Scanner_Path>\bin\module1\src
  6. To convert then  XML metadata into scan able JavaScript, execute below command.
    1. java -jar SourceCode_Extract_V3.jar C:/mani/dev/amx-peru/om/drop2/sprint_3/07-JAVA/core/metadata/ C:/mani/tools/java/sonar-scanner-cli-3.0.3.778-windows/sonar-scanner-3.0.3.778-windows/bin/module1/src
  7. Above command will create the JavaScript metadata corresponding to the given source code in the path <Sonar_Scanner_Path>\bin\module1\src
  8. Start Sonar Qube by executing StartSonar.bat file from the path:<SonarQube_Path>\bin\windows-x86-32
  9. Above command will run the sonar qube engine in 9000 port. We can access it by http://localhost:9000/projects
  10. Start Sonar Scanner by executing sonar-scanner.bat file from the path : <Sonar_Scanner_Path>\bin
  11. On Start,  sonar scanner will scan the project based on the inputs details given in sonar-scanner.properties
  12. On Completion of scan, below message is displayed

  1. Scanned result can be accessed through http://localhost:9000/dashboard/index/project_name:app_name

0 comments :

Post a Comment

 
Top