Problem with custom xml rule

Hi, i’m trying to make a rule in which the version of xpto.micronaut cannot be lower than 4.9.*, however, the rule is not being applied.

SonarQube version: 10.2.1

My custom rule:

My project pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""




        <finalName>${pom.artifactId}-${pom.version}</finalName>  <!-- Code smell test -->

Please help me.


The screenshot of your rule shows a forbidden version of 4.10.*. Since 4.9.0.RC != 4.10.*, I’m not surprised no issue is raised.

Based on the text in the screenshot, I suspect you need a version pattern something like 1.0.*-4.8.*


Hi Ann, thank you for your help!

I switched to the 1.0.*-4.8.* pattern, but it didn’t work either. Is there a problem with this being in a <parent> tag and not in a <dependency> tag ?


Well… the rule is built to look at… dependencies.

I would play around with it:

  • try setting the version specifically to the one in your pom
  • try moving the dependency to actually show up in the pom as a dependency


Hi Ann! Thanks for helping me! The problem is that it doesn’t really work in the <parent> tag, it necessarily has to be in the <dependency> tag.

Now I’m going to have to find a solution for this, do you have any suggestions?

Thank you very much.


Your other option is xml:XPathCheck, which is a pure XPath 1.0 query template rule. It’s doable, but a looot harder.

And when you’re looking up XPath syntax guides, make sure you stick to 1.0 syntax.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.