Couldn't get value from property when setting onlyOnQualifiers(Qualifiers.PROJECT)

I want some property to be configurable or overridden at the project scope.
I used for this
onlyOnQualifiers(Qualifiers.PROJECT)
or
onQualifiers(Qualifiers.PROJECT)
They are shown correctly in “Administration” tab of the project
but the problem is that I couldn’t get the value of configured per project properties.
To get the value I use
org.sonar.api.config.Configuration#get

Hi,

How do you get the Configuration component? Is it from a server side or scanner side extension?

Hi @Julien_HENRY,
I write own class that implements org.sonar.api.Plugin
In that class

Plugin define method is called very early in scanner or server startup lifecycle, and there is no concept of project at that time. The Javadoc of getBootConfiguration is pretty clear about that IMO, but we can still improve it if needed.

Basically you can’t alter plugin loading by a project setting.

Maybe if you share a bit more about your use case we could help you to find a solution.

Thanks, @Julien_HENRY,
that helps to understand, why properties not present when I define all plugins extension.

#1 I need those Project scope properties during when I do org.sonar.plugins.java.api.JavaCheck. Please could you advise, what extension could be used to get Project scope properties or is somehow possible to retrieve them during org.sonar.plugins.java.api.JavaCheck

#2 Could you please, point me to doc which describes “plugins extensions lifecycles”

See my answer here:

The main documentation is here, other information should be looked for in the javadoc or in example plugins.

1 Like