I am trying to connect SonarQube to Jenkins.I have installed SonarQube plugin and I have set up the SonarQube server in “Configure system” of jenkins. I have done sonarscanner installation in “Global tool configuration” of jenkins. I am giving below code in pipeline:
node {
stage(‘SCM’) {
git ‘path to git’
}
stage(‘SonarQube analysis’) {
def mvnHome = tool name: ‘M3’, type : ‘maven’
withSonarQubeEnv(credentialsId: ‘admin’) {
// some block
// If you have configured more than one global server connection, you can specify its name
‘sh ${mvnHome}/bin/mvn clean package sonar:sonar’
}
}
}
I am getting warning WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed? and there is no report generated in sonarqube about the code smells. Can anyone help
Thanks Ann. Not sure what you are asking. Please find my code below:
node {
stage(‘SCM’) {
git ‘https://github.com/rkadiyali/jpmc.git’
}
stage(‘SonarQube analysis’) {
def mvnHome = tool name: ‘M3’, type : ‘maven’
withSonarQubeEnv(credentialsId: ‘admin’) {
‘sh ${mvnHome}/bin/mvn sonar:sonar’
}
}
}
I want to pull code commited in github to jenkins and run sonarqube analaysis on it. Can you please help?
Your script includes a Maven analysis, but I don’t see that analysis command reflected in the logging you’ve provided. I don’t know where to tell you to look for that logging, but we’re not going to get very far without it.