Custom rule for xml not working as expected

I am using SonarQube 7.9.6 and trying to apply some custom validations on the pom.xml of my Mulesoft project using xpath.

I have created a rule and attached it to the extended quality profile of the XML language. However, when I run the command “mvn sonar:sonar” – on the dashboard, I do not see the rule failing even though it should (e.g. XPATH(1=2) which would always return false).

I have set the <sonar.sources> correctly. Can anyone provide some insight on why the validation is not failing?


Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.6 → 8.9.10 → 9.8 (last step optional)

(Note that the release of a new LTS, 9.9, is expected on 7 Feb 2023.)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.