A while ago I setup Sonar to scan a development project. The scans are invoked nightly using a cronjob. At one point I had an issue with the machine that run the cronjob and a few nightly scans were missed. I downloaded the source code from one of the days that was missed, and completed a new Sonar scan using Sonar Runner. As I expected the data shows up in Sonar as the most recent scan which is not what I want. I would like to inject that scan in to a specific date so I can fill the days when the scan was not run. I did not see an option to do this in the sonar-project.properties file.
Is there a way I can run a Sonar scan, but have the data be entered on a date of my choice rather than the current date, so it shows up in the appropriate position in my Sonar timelines?
I haven’t used them but the Sonar documentation describes the additional properties that would enable historical analysis. Specifically it’s the “sonar.projectDate” property you need to set.
You haven’t specified which Java build technology you’re using. I’ve included some examples below.
Finally, have you considered setting up Jenkins to launch Sonar, instead of cron? Lots of good reasons for running Jenkins, but if you’re using Maven as your build tool, the Jenkins Sonar plugin makes Sonar integration very easy.
Maven example
ANT example
Note: