Sonar7.0试用

代码质量是软件持续维护下去的基础。sonar在这方面功能比较全。今天试用sonar7.0。文档查询地址https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Maven

 使用过程中注意:

1、对 mysql老版本不支持。需要事先看一下版本说明。或者采用欺骗方式修改sonar配置文件;

2、对于JDK要求1.8以上。在编译devops仪表盘的时候,发现有些软件还要求小版本好要求在53以上。

2、错误现象

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project core: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar: org/sonar/batch/bootstrapper/IssueListener
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:sonar-maven-plugin:3.0.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/mavenlib/org/sonarsource/scanner/maven/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
[ERROR] urls[1] = file:/home/mavenlib/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[2] = file:/home/mavenlib/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = file:/home/mavenlib/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[4] = file:/home/mavenlib/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = file:/home/mavenlib/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/home/mavenlib/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[7] = file:/home/mavenlib/org/sonarsource/sonar-runner/sonar-runner-api/2.5.1/sonar-runner-api-2.5.1.jar
[ERROR] urls[8] = file:/home/mavenlib/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[9] = file:/home/mavenlib/com/google/guava/guava/18.0/guava-18.0.jar
[ERROR] urls[10] = file:/home/mavenlib/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

3、接近方法:pom文件增加下面内容

       
          org.codehaus.mojo
         
          sonar-maven-plugin
          3.4.0.905
       

或者


  
    
      
        org.sonarsource.scanner.maven
        sonar-maven-plugin
        3.4.0.905
      
    
  




你可能感兴趣的:(开发辅助工具)