Sonarqube
server
Installing SonarQube from the Docker image
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
https://docs.sonarsource.com/sonarqube/10.5/try-out-sonarqube/