#!/bin/bash

mvn --batch-mode verify sonar:sonar \
    -Dsonar.host.url=http://192.168.0.51:9000 \
    -Dsonar.login=admin \
    -Dsonar.password=admin \
    -Dsonar.analysis.mode=preview \
    -Dsonar.gitlab.project_id=$CI_PROJECT_ID \
    -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA \
    -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME  \
    -Dsonar.projectKey=org.sonarqube:java-print-demo-scanner \
    -Dsonar.projectName=Java :: Print Demo :: SonarQube Scanner \
    -Dsonar.projectVersion=1.0 \
    -Dsonar.sources=src \
    -Dsonar.language=java \
    -Dsonar.sourceEncoding=UTF-8
if [ $? -eq 0 ]; then
    echo "sonarqube code-analyze-preview over."
fi