I have a problem with Gitlab CI, Maven and SonarCloud.
I use the jdk 8 so I had to use <sonar.scanner.force-deprecated-java-version>true</sonar.scanner.force-deprecated-java-version>
to be able to use Sonar but however I still have an error!
Gitlab-ci.yml
image: maven:latest
variables:
MAVEN_CLI_OPTS: "--batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
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
cache:
paths:
- .m2/repository/
- target/
sonarcloud-check:
image: maven:3.6.3-jdk-8
stage: test
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- mvn verify sonar:sonar
build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS compile
test:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test
Thank you for your reply