1

My projects are built with Maven 3.0 and use the plugin build-helper to set the following properties at the initialization phase : parsedVersion.majorVersion, parsedVersion.minorVersion It works well for the build, where I also set sonar.branch=parsedVersion.majorVersion.parsedVersion.minorVersion

In Jenkins, I add the Post Build Step "Sonar analysis" (from Sonar plugin for Jenkins), it ends up with the following error:

Can not execute SonarQube analysis: Illegal character in query at index 108: 
http://<sonar url>/sonar/batch_bootstrap/properties?project=com.x.y.<ArtifactId>:${parsedVersion.majorVersion}.${parsedVersion.minorVersion}

So the properties values were not instanciated correctly.

Did anyone encounter the issue ? is there a solution or is it a bug in Jenkins or Jenkins sonar plugin ?

blackbuild
  • 5,026
  • 1
  • 23
  • 35
Gurvan
  • 741
  • 1
  • 9
  • 22

1 Answers1

0

You need to explicitly run the initialization phase.

Include -Dsonar.phase=initialize in your additional properties.

blackbuild
  • 5,026
  • 1
  • 23
  • 35
  • Thanks, this should do the thing, will test ASAP – Gurvan Mar 07 '14 at 16:05
  • sonar.phase is deprecated what should i do? – burtsevyg Nov 25 '15 at 14:10
  • @burtsevyg: if you use the newest version of the SonarQube plugin you should not use the sonar-qube publisher, instead, use a custom maven step and simply include the relevant phase in your call, i.e. "initialize sonar:sonar ...". see http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+Jenkins – blackbuild Nov 25 '15 at 14:20
  • I want to use sonar-maven-plugin in profile with maven-jgit-buildnumber-plugin which provide ${git.branch} variable which I put in ${git.branch}, but sonar say: " Validation of project reactor failed: [ERROR] o "${git.branch}" is not a valid branch name." I don't understand why, why it is not empty by the way? – burtsevyg Nov 25 '15 at 14:32
  • @burtsevyg Because maven replaces only existing properties, that's simply how it works. Do you use the Jenkins plugin or do you call maven in the command line? might be best to create a new question and link it here... – blackbuild Nov 25 '15 at 14:49