'Unable to validate pom.xml of a mule application in SonarQube

I am using SonarQube to validate artifactId, modelVersion etc in pom.xml file for a mule application.To validate these nodes, I have build some rules in SonarQube.but seems,POM rules are not working.Here is my pom xml and code rules.

<rule id ="2" name="Pom Model Version should be 4.0.0"
        description="Pom Model Version should be 4.0.0"
        severity="MAJOR" type="code_smell">

    //*[local-name()='project']/*[local-name()='modelVersion']= '4.0.0'
            
</rule>  

<rule id="3" name="Application Name is too long ok"
        description="Application Name is too long, give a proper name"
        severity="MAJOR" applies="application" type="code_smell">

    string-length(//*[local-name()='project' ]/*[local-name()='artifactId'])>20

</rule>

<rule id ="4" name="Mule Runtime Version should be 4.2.0"
        description="Mule Runtime Version should be 4.2.0"
        severity="MAJOR" type="code_smell">

    //*[local-name()='project']/*[local-name()='properties']/*[local-name()='app.runtime']= '4.2.0'

</rule>         
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>security</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>mule-application</packaging>

    <name>security-token-project</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <app.runtime>4.3.0-20201013</app.runtime>
        <mule.maven.plugin.version>3.3.5</mule.maven.plugin.version>
        <sonar.sources>/</sonar.sources>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule.maven.plugin.version}</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-http-connector</artifactId>
            <version>1.5.22</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-sockets-connector</artifactId>
            <version>1.2.0</version>
            <classifier>mule-plugin</classifier>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>anypoint-exchange-v2</id>
            <name>Anypoint Exchange</name>
            <url>https://maven.anypoint.mulesoft.com/api/v2/maven</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>https://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-releases</id>
            <name>mulesoft release repository</name>
            <layout>default</layout>
            <url>https://repository.mulesoft.org/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>

My other rules to validate other xml files are working but above three rules are not working as expected.



Solution 1:[1]

<sonar.sources>/</sonar.sources> 
<sonar.inclusions>**.xml</sonar.inclusions>
<sonar.exclusions>target/**.xml</sonar.exclusions>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wai Ha Lee