Getting information during server startup

Hi there,

we are currently working on shipping built-in quality profiles with our java plugin and had some questions on getting information about the server at startup:

1) Is there a way of knowing which other plugins are currently installed on the server? The issue is, if our quality profile is looking for rules from external plugins that are not installed, the server won’t start. So our thinking was that we could filter those rules, depending on whether the required plugins are there or not.

2) Is it possible to get the information if our quality profile is newly created on the server or merely updated? We would like to set the profile as default when our plugin is installed the first time, but we don’t want to override the users default quality profile settings every time their server starts up.

3) Since we are also using some of the standard java rules from sonar directly, we would like to get the version of the Sonar Java Analyzer that is currently in use on the server. Since the repo keys of those rules changed from ‘squid’ to ‘java’, we would like to check if the version of the analyzer is 6.0 or lower, and set the repo keys accordingly. Is that possible somehow?

Thanks a lot in advance and greetings!
Lmar

Is there a way of knowing which other plugins are currently installed on the server?

No, unfortunately the architecture of SonarQube does not allow to do that, plugins are not aware of each other. So the only thing I can advice is to have Java analyzer as a prerequisite for your plugin

Is it possible to get the information if our quality profile is newly created on the server or merely updated

That’s also not possible. Also I think that’s not very user-friendly to change default profile with third-party plugin. Moreover SonarQube server start up will fail if several default profiles are defined for the same language. So let user do it manually if he wants to.

we would like to get the version of the Sonar Java Analyzer that is currently in use on the server

And that’s also not possible. In such cases plugin usually releases an update which is compatible with particular version of Java analyzer.