Hi All,
I am new to the devops field and I am trying to perform some hands on to learn devops tools.
I am trying to integrate SonarQube with the jenkins and by doing so I am facing this issue
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project copilot-backend: Not authorized. Please check the user token in the property 'sonar.token' or the credentials in the properties 'sonar.login' and 'sonar.password'. -> [Help 1]
Below is the detail of my jenkins pipeline
pipeline {
agent any
tools {
maven 'mvn'
}
environment {
scannerHome = tool name: 'SonarQube', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
}
stages {
stage('Fetch Code') {
steps {
echo "Fetching code for <project-repository>: branch: develop"
git branch: 'develop',
credentialsId: 'BITBUCKET_ID',
url: '<repo_url>'
}
}
stage('Build and Code Analysis') {
steps {
script {
withCredentials([string(credentialsId: 'SONARQUBE_TOKEN', variable: 'SONAR_TOKEN')]) {
withSonarQubeEnv('SonarQube') {
echo "********************************Credentials and environment variable properly configured********************************"
def mvnCommand = 'mvn clean verify sonar:sonar ' +
'-Dspring.profiles.active=local ' +
'-Dsonar.projectKey=<project_key>' +
'-Dsonar.projectName="<project_name>" ' +
'-Dsonar.host.url=http://127.0.0.1:9000 ' +
'-Dsonar.token=$SONAR_TOKEN'
if (isUnix()) {
sh mvnCommand
} else {
bat mvnCommand
}
}
}
}
}
}
}
}
can anyone please help me solve this issue I am unable to find the solution for this