Must-share information (formatted with Markdown):
- SonarQube Developer Edition Version 8.6.1 (build 40680)
- Add SonarQube to our GitLab CI pipeline
I have:
- successfully installed the db and server.
- confgiured ALM integration (GitLab API URL, personal access token)
- added SONAR_HOST_URL and SONAR_TOKEN as env variables in GitLab
- added Maven Project throgh SonarQube UI
- copy/pasted sonar.projectKey and sonar.qualitygate.wait in in my parent pom.xml
- added the following to my .gitlab-ci.yml
sonarqube-check:
<<: *need_build_artifacts
stage: test
#image: maven:3.6.3-jdk-11
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
MAVEN_CLI_OPTS: "-DskipTests --settings .gitlab-mvn-settings.xml --batch-mode --errors --show-version"
MAVEN_REPO_PATH: $CI_PROJECT_DIR/.m2/repository
FAIL_NEVER: 1
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- docker login <REMOVED>
- mvn $MAVEN_CLI_OPTS verify sonar:sonar -DskipCompiler=true -Dskip.npm=true
allow_failure: true
After submitting the pipeline runs but I get the following error:
Caused by: org.sonar.api.utils.MessageException: Project '<PROJECT_KEY>' can't have 2 modules with the following key:
I do see numerous work around solutions, but cannot find anything in the official documentation about best-practice for multi-module maven files with SonarQube.
I’m looking for a quick and easy win to evaluate SonarQube before my 2 week eval period expires.
Should I be setting up each module with it’s own project / key?
Should I be using prefix keys (of which I can find no documentation about?)