sonar-qube

安装

下载

下载长期支持版
image

docker compose

version: '3'
services:
  postgres:
    image: postgres:12.3
    restart: always
    container_name: postgres
    ports:
      - 5432:5432
    volumes:
      - /opt/sonarqube/postgres/postgresql:/var/lib/postgresql
      - /opt/sonarqube/postgres/data:/var/lib/postgresql/data
      - /etc/localtime:/etc/localtime:ro
    environment:
      TZ: Asia/Shanghai
      POSTGRES_USER: sonar
      POSTGRES_PASSWORD: sonar
      POSTGRES_DB: sonar

  sonar:
    image: sonarqube:7.9.2-community
    container_name: sonar
    depends_on:
      - postgres
    volumes:
      - /opt/sonarqube/sonarqube/extensions:/opt/sonarqube/extensions
      - /opt/sonarqube/sonarqube/logs:/opt/sonarqube/logs
      - /opt/sonarqube/sonarqube/data:/opt/sonarqube/data
      - /opt/sonarqube/sonarqube/conf:/opt/sonarqube/conf

      - /etc/localtime:/etc/localtime:ro
    ports:
      - 9000:9000
    command:
      - -Dsonar.ce.javaOpts=-Xmx2048m
      - -Dsonar.web.javaOpts=-Xmx2048m
      - -Dsonar.web.context=/
      - -Dsonar.core.serverBaseURL=https://sonarqube.example.com
    environment:
      TZ: Asia/Shanghai
      SONARQUBE_JDBC_USERNAME: sonar
      SONARQUBE_JDBC_PASSWORD: sonar
      SONARQUBE_JDBC_URL: jdbc:postgresql://postgres:5432/sonar

使用配置

安装汉化插件

image

安装Java代码质量插件

image

mvn sonar:sonar -Dsonar.projectKey=jh4j -Dsonar.host.url=http://172.16.1.117:9000 -Dsonar.login=75ec0f3ed54581b7e605ae360e028dbeab0084dc
posted @ 2021-08-19 23:26  fight139  阅读(82)  评论(0编辑  收藏  举报