eight
eight

Reputation: 351

SonarQube doesn't detect rules with new pmd plugin

I am using SonarQube v 5.0.1 I have put my rules.xml file in extensions/rules/pmd directory. Now everything works if i use sonar-pmd-plugin version 2.3 - i start sonar, go to rules search and can find all the rules in rules.xml file. But after switching to sonar-pmd-plugin version 2.4 i can't find my rules. I have switched PMD version in older (v 2.3) plugin and it had no effect so i guess it's not PMD, it's the plugin. Has the default directory of rules changed with latest pmd plugin or something? Couldn't find anything in documentation.

Upvotes: 0

Views: 598

Answers (2)

fedesg
fedesg

Reputation: 15

I had the issue with Sonarqube 5.6.3 and the sonar-pmd-plugin 2.6. So, to see my custom rules I need to do the following:

  • Put the ruleset definition jar file and the rules list xml file in the extensions/rules/pmd path, to do this I follow this post.
  • Downgrade the plugin to the 2.3 version.
  • Add the custom rules in the pmd.properties file in the plugin, this files is in org/sonar/l10n/. E.g.:

    #Add pmdAtgRules
    rule.pmd.ActionClassName.name=ActionClassName
    rule.pmd.BreaksLogging.name=BreaksLogging
    
  • Restart Sonarqube.

Upvotes: 0

Glenn
Glenn

Reputation: 48

I had the same issue with Sonarqube 4.5.5. Downgrading the sonar-pmd-plugin from 2.4 to 2.3 solved it. Now I can see the custom rules I put in extensions/rules/pmd.

Upvotes: 1

Related Questions