Are you sure you’ve added your XPath rule to the profile in use? Creating the rule isn’t enough; you need to activate it in the profile being used to analyze your project.
If you’re using the Sonar way profile, you’ll need to create a new profile, since that profile isn’t modifiable. The docs should help.
I can see my test file “app.java” is indexed in the code page in sonarqube wtihout any issues.
En,I tried to create an xpath rule for xml, xpath expression="/project/properties[sonarqube.version=8.9.0.43852]", add the rule to profile “custom-xml-rules”. The rule works and reports issues.
Can you show me a valid example for java xpath rule configuration?
This is probably a question of correctly structuring the XPath to address the AST created by Java analysis. We used to publish a checker, but I guess that went away when we deprecated the rule. So… I’m not sure what help anyone can be. Your best bet is probably to switch to writing this in Java via a custom plugin.
I know that’s not what you want to hear, but it’s the best I’ve got.