A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/715 below:

[xml] ProjectVersionAsDependencyVersion false positive · Issue #715 · pmd/pmd · GitHub

Rule Set: POM / ProjectVersionAsDependencyVersion

Description:
The rule just looks for usages of ${project.version} and ignores valid usages.

Code Sample demonstrating the issue:

    <test-code>
        <description>Valid usage child modules</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>a-child</artifactId>

    <parent>
        <groupId>net.sourceforge.pmd</groupId>
        <artifactId>parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>net.sourceforge.pmd</groupId>
            <artifactId>a-different-child</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</project>
     ]]></code>
        <source-type>pom</source-type>
    </test-code>

The XPath could be improved to be this:

/project[version]/dependencies/dependency/version/text[contains(@Image,'{project.version}')]

which will require an own version tag. But we probably should somehow look at the groupId of this project (could be inherited from parent) and the groupId of the dependency, which uses "project.version".


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4