How to access sonar property file while analyzing the projects.

27 views
Skip to first unread message

Siva Shankar

unread,
Feb 15, 2016, 8:34:59 AM2/15/16
to SonarQube
How to access sonar property file while analyzing the projects.I need base folder which we have to mention in sonar-project property file.

G. Ann Campbell

unread,
Feb 15, 2016, 9:02:17 AM2/15/16
to SonarQube
Please don't cross-post with StackOverflow. We keep an eye on both places, but only at best. Posting the same query in both places will not speed your chances of getting a good answer. It is more likely to do the opposite.

Francis Galiegue

unread,
Feb 16, 2016, 5:45:30 PM2/16/16
to SonarQube
Hello,


On Monday, February 15, 2016 at 2:34:59 PM UTC+1, Siva Shankar wrote:
How to access sonar property file while analyzing the projects.I need base folder which we have to mention in sonar-project property file.

Not sure whether that answers your question; but the contents of sonar-project.properties are available to plugins if you pass a Settings instance to the constructor of whatever needs it.

This is due to the way SonarQube uses IoC; basically, ANYTHING implementing BatchComponent will be available as constructor parameters to classes on the "client side" of things, that is, basically, code analysis. And anything implementing ServerComponent is available if you write a server plugin.

Given that the contents of sonar-project.properties are automatically injected into a Settings instance, you want to add an instance of Settings in your plugin where it is necessary.

[side note: this is not obvious from the documentation alone; unfortunately]
 
Reply all
Reply to author
Forward
0 new messages