Custom property validation

I write Java plugin for sonarQube.
I need some properties to be configured.
So I added them via
public Plugin.Context addExtensions(Collection extensions)
I pass List of PropertyDefinition as it written in docs

#1. The problem is that I couldn’t extend PropertyDefinition to add custom validation as class PropertyDefinition is final. Could you advice how to achieve this goal or it is forbidden?

#2. The properties are global not per Project, could you advice what to use to configure custom properties per Project?


  1. You can’t add custom validations. You can only use the existing types.

  2. To restrict a property to a certain scope (global, project, both), use onQualifiers​ or onlyOnQualifiers​ with Qualifiers.PROJECT:

  • By default a property is global.
  • onQualifiers(PROJECT) will make it appear on projects settings in addition to global.
  • onlyOnQualifiers(PROJECT) will make it only visible at project level.
1 Like

Hi Julien Henry, thank you, it helps.
Please, could you assist with this task