How to Analysis my code in Jenkins Job through SonarQube Scanner

Hi All,

I want to run my code which is save in my laptop.

  1. I have install Jenkins version is 2.268 in my laptop through container its running.


    image
  2. Sonar Server also running as container in my laptop
    (sudo docker run --rm -p 9000:9000 -v sonarqube_conf:/opt/sonarqube/conf -v sonarqube_extensions:/opt/sonarqube/extensions -v sonarqube_logs:/opt/sonarqube/logs -v sonarqube_data:/opt/sonarqube/data sonarqube)
  3. sonar server version is sonarqube-8.5.1.38104 and SonarQube Scanner version is sonar-scanner-4.5.0.2216-linux.
  4. my code which i want to analysis and run is on this location
    /home/mohd/Desktop/fxt/Web/src/main/ui/ and see below is the screenshot.
  5. In Jenkins i have create a one job see below screenshot
  6. when i analysis that code i got error see below screenshot
  7. Here is the global tool configuration in that plugin see below screenshot
  8. Here is the global tool configuration of JDK 11 and JDK8 both see below screenshot
  9. Here is the configure system of jenkins see below screenshot
  10. Here is the screenshot of sonar-project.proprieties
    image

Help me out on how to analysis code or how to add the correct location or path in that jenkins ?

Hi,

Your sonar.sources value needs to be relative to where analysis is run from. Its shouldn’t start at box root but from the Jenkins workspace.

 
HTH,
Ann