docker安装sonarqube

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

  • 安装数据库
docker run --name db -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -d postgres
  • 安装sonar

用docker安装soanrqube时,sonarqube会默认使用用户名sonar,密码sonar,似乎无法改变

docker run --name sq --link db -e SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar -p 9000:9000 -d sonarqube
  • 默认账户密码 admin/admin

  • 执行命令,检测代码质量

mvn sonar:sonar \
  -Dsonar.host.url=http://111.231.104.224:9000 \
  -Dsonar.login=49bb86b8f2da62731f6677c6d0bc41757d5ed880

参考资料

官网maven中使用sonar

maven中配置sonar


    
        org.sonarsource.scanner.maven
    
    
        
            sonar
            
                true
            
            
                
                
                  http://myserver:9000
                
            
        
     

Analyzing a Maven Project

mvn clean verify sonar:sonar
  
# In some situation you may want to run sonar:sonar goal as a dedicated step. Be sure to use install as first step for multi-module projects
mvn clean install
mvn sonar:sonar
 
# Specify the version of sonar-maven-plugin instead of using the latest. See also 'How to Fix Version of Maven Plugin' below.
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar

Project analyzed with Maven 3


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

转载于:https://my.oschina.net/haokevin/blog/1788365

你可能感兴趣的:(docker安装sonarqube)