What I've done so far:
1) I am using TeamCity as the CI.
2) Already have a SonarQube server up and running.
3) Already have a Bitbucket account.
4) I put the sonar-bitbucket-plugin-1.2.0.jar file in the /extensions/plugins folder. Restarted the sonarqube server afterwards
5) I added a sonar.json file to each module of the project containing the following:
{
"sonarHost": "<sonarqube server ip address>",
"sonarProjectKey": "<sonarProjectKey taken from sonar host>"
}
6) Installed the sonar for bitbucket plugin.
7) I created a consumer in the OAath section of Bitbucket Settings, with permissions specified in the github bitbucket plugin project (https://github.com/mibexsoftware/sonar-bitbucket-plugin), in order to collect key and secret codes.
8) I executed the following command on one of the modules of the repository:
mvn clean verify sonar:sonar --batch-mode --errors -Dsonar.bitbucket.repoSlug="<repoSlug>" -Dsonar.bitbucket.accountName="<accountName>"-Dsonar.bitbucket.apiKey="<apiKey>" -Dsonar.bitbucket.branchName="<branchName>" -Dsonar.host.url="<serverUrl>" -Dsonar.analysis.mode=issues
The sonar analysis runs smoothly, but after getting to the bitbucket bit, I get the following error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project dispatcher: Unable to load component class ch.mibex.bitbucket.sonar.client.BitbucketClient: [sonar4bitbucket] Either team-based API or an OAuth user must be given -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project dispatcher: Unable to load component class ch.mibex.bitbucket.sonar.client.BitbucketClient
For the apiKey property, I used either the key or secret codes from the OAuth consumer.
What am I missing ?