Custom java plugin : duplicate language

Hello
I write several custon plugins on the same java code template for multiple languages.
The plugins related to new languages (Powerbuilder, Aspx, etc) are working fine.
As soon as I load the java or the php custom plugin, I get the following error “java.lang.IllegalArgumentException: Multiple entries with same key: php=PHP and php=Php”

Is it possible to add custom plugins to already existing languages in the SonarQube server, and how ?

Thanks for your help

PS: tested for SQV7.6, it worked well to SonarV4.2

Hi.

Please check what is the pluginKey of your custom plugin (in the pom.xml) and the name of your custom reposity. It should be different than “php”. See the example:

  • pluginKey is “php-custom”:
  • the repositoryKey is “custom”:

Thanks Felipe

It appears that my pluginKey is qcr4php for example, so no problem with this.
Unfortunately, the problem seams related to the fact that two plugins must not define the same language (php or java, etc) see [1]
I don’t really understand this. Since in the QualityProfile view one can choose the default profile, it should be possible to create 2 plugins for those languages, then select the default one.

Can SonarSource confirm that a custom plugin cannot provide analysers for languages SonarSource delivers, and since which SQ versions ?
By the way, it was not the case in old versions (4.2 for example)

Thanks for your help

[1] : https://stackoverflow.com/questions/35310698/sonarqube-background-tasks-failing-with-multiple-entries-with-same-key

Greetings,

Only one plugin can declare a language. The implicit convention is to declare a language only if the plugin handle all “language related” features, like highlighting, core measures, cpd, …

Multiple plugins can contribute rules for a language. A plugin does not have to declare a language to contribute rules for a language.

Does that help?

Best regards,

Colin

Thanks Colin for your quick answer !

Well my purpose is to handle the full set of feature for those languages according to a custom syntax analyser and custom metrics and fonctional rules too. Well, I’ll create special language names, a bit sad though.
Didier