#!/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 \
    clean install

if [ $? -eq 0 ]; then
    echo "sonarqube code-analyze-preview over."
fi