美文网首页
Windows下安装Sonar-scanner

Windows下安装Sonar-scanner

作者: 小圆圈Belen | 来源:发表于2020-10-09 23:00 被阅读0次

    Windows下安装sonarqube:https://www.jianshu.com/p/118dcf612333
    Windows下安装mysql:https://www.jianshu.com/p/ffcbfa05771f

    下载

    官网地址:https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/

    image.png

    配置

    环境变量的配置:


    验证配置成功

    命令行输入sonar-scanner -version,出现下面界面表示sonar-scanner安装配置成功。

    image.png

    扫描代码设置

    1.到要检查的代码根目录下创建文件sonar-project.properties

    # must be unique in a given SonarQube instance
    sonar.projectKey=study
    # this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
    sonar.projectName=study
    sonar.projectVersion=1.0
    
    # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
    # This property is optional if sonar.modules is set.
    sonar.sources=./src
    
    sonar.java.binaries=./target/classes
    sonar.language=java
    # Encoding of the source code. Default is default system encoding
    #sonar.sourceEncoding=UTF-8
    
    

    2.命令行到要检查的代码目录下,输入命令:sonar-scanner
    检查的结果直接可以在浏览器SonarQube上查看

    image

    相关文章

      网友评论

          本文标题:Windows下安装Sonar-scanner

          本文链接:https://www.haomeiwen.com/subject/rkerpktx.html