SonarQube “Class Not Found” during Main AST Scan

前端 未结 3 556
北海茫月
北海茫月 2021-01-03 01:20

My setup:

  • Sonarqube 5.1.1
  • Sonar-Maven Plugin 2.6 (also tried 2.7 and 3.6)
  • JDK 1.7.0_51

Example of the error:

1         


        
3条回答
  •  北海茫月
    2021-01-03 01:58

    To avoid adding SonarQube specific dependencies to your project, define a profile like this:

        
            sonarqube
            
                
                    org.joda
                    joda-convert
                    1.2
                
                
                    com.google.code.findbugs
                    jsr305
                    3.0.0
                
            
        
    

    Then run your sonar analysis with a command like

    mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar -Psonarqube,sonarqube-dev
    

    The sonarqube-dev profile is defined in my ~/.m2/settings.xml and it just specifies where my development environment SonarQube installation is

        
            sonarqube-dev
            
                
                
                    http://localhost:9000/
                
            
        
    

    What is achieved by all this?

    • sonarqube analysis specific dependencies don't pollute the project unnecessarily
    • no sonarqube maven plugin defined in pom.xml. Each developer and Jenkins can use whatever sonar plugin and server installation they wish

提交回复
热议问题