“Sonarqube”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
第101行: 第101行:
  
 
[https://testerhome.com/topics/10064 devops [持续交付实践<nowiki>]</nowiki> 基于 sonarqube 的代码检查平台实现]
 
[https://testerhome.com/topics/10064 devops [持续交付实践<nowiki>]</nowiki> 基于 sonarqube 的代码检查平台实现]
 +
 +
 +
[https://medium.com/@denis.verkhovsky/sonarqube-with-docker-compose-complete-tutorial-2aaa8d0771d4 SonarQube with Docker compose: complete tutorial]
  
 
[[category:devops]]
 
[[category:devops]]

2024年9月27日 (五) 14:15的版本

server

Installing SonarQube from the Docker image

参考 https://docs.sonarsource.com/sonarqube/10.5/setup-and-upgrade/install-the-server/installing-sonarqube-from-docker/


    login: admin
    password: admin


cat docker-compose.yml
version: "3"

services:
  sonarqube:
    image: sonarqube:community
    depends_on:
      - db
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
      SONAR_JDBC_PASSWORD: sonar
    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_logs:/opt/sonarqube/logs
    ports:
      - "9000:9000"
  db:
    image: postgres:12
    environment:
      POSTGRES_USER: sonar
      POSTGRES_PASSWORD: sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data

volumes:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_logs:
  postgresql:
  postgresql_data:

安装Sonar-Scanne

zip https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner/


 cd data/apps
10006  ls
10007  unzip sonar-scanner-cli-6.1.0.4477-linux-x64.zip

vim /etc/profile

#配置sonar-scanner

export SONARRUNNER_HOME=/home/evan/data/apps/sonar-scanner-6.1.0.4477-linux-x64
export PATH=$SONARRUNNER_HOME/bin:$PATH


vi sonar-project.properties # 有些信息可能要改  eg port 9000  ,password
# must be unique in a given SonarQube instance
sonar.projectKey=mytest
# this is the name displayed in the SonarQube UI
sonar.projectName=mytest
sonar.projectVersion=1.0
sonar.java.binaries=target/classes
sonar.sources=src
sonar.host.url=http://192.168.10.105:30004
sonar.login=admin
sonar.password=12345
sonar.java.binaries=target/classes
sonar.java.test.binaries=target/classes
sonar.java.surefire.report=target/surefire-reports

  509  sonar-scanner

00:31:42.783 INFO  Analysis total time: 6.861 s
00:31:42.784 INFO  EXECUTION SUCCESS
00:31:42.784 INFO  Total time: 8.380s


 Maven Fatal error compiling: 错误: 无效的目标发行版:17

升级jdk 
jave home 改为 21的 或者大于17的


references

devops [持续交付实践] 基于 sonarqube 的代码检查平台实现


SonarQube with Docker compose: complete tutorial