Hello,
I’m trying to follow the Maven example from the documentation to set up a new SonarCloud scan using Bitbucket Pipeline. The example I’m following is here->https://bitbucket.org/sonarsource/sample-maven-project/src/master/
I have SONAR_TOKEN set up as a repository variable.
Here is my bitbucket-pipelines.yml:
image: maven:3.6.1
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- maven
- sonar
script:
- echo $SONAR_TOKEN
- cd Project
- mvn -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
artifacts:
- target/**
- step: &build-test
name: Build and test
caches:
- maven
script:
- mvn -B verify
artifacts:
- target/**
pipelines:
default:
- step: *build-test-sonarcloud
branches:
master:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
This is failing with the following error:
[INFO] Bitbucket Cloud Pipelines detected
[INFO] User cache: /root/.sonar/cache
[INFO] SonarQube version: 8.0.0
[INFO] Default locale: "en", source code encoding: "UTF-8"
[INFO] Load global settings
[INFO] Load global settings (done) | time=588ms
[INFO] Server id: 86E9293D-KRHW8ct9-T_TB3XqobKk
[INFO] User cache: /root/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=137ms
[INFO] Load/download plugins (done) | time=26007ms
[INFO] Loaded core extensions: developer-scanner
[INFO] No project and organization key detected from Bitbucket Cloud Pipelines.
[INFO] Process project properties
Shouldn’t it be discovering the organization and project keys via the SONAR_TOKEN? Can someone point me in the right direction?
Thanks!