Affects PMD Version:
6.10.0
Rule:
all rules for "Maven POM", tested with ProjectVersionAsDependencyVersion
Description:
When running PMD on Maven POM files (by convention named pom.xml), the files aren't being picked up for validation.
The PomLanguageModule seems to define Maven POM files as XML files having a "pom" extension.
Is there a configuration that makes PMD pick up a pom.xml instead of looking for a something.pom?
Code Sample demonstrating the issue:
Given this example pom.xml (a failing example taken from the PMD unit tests)
<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>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>xml-pom</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>x.y.z</groupId>
<artifactId>z</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
and running PMD with
# should report the dependency version in ~/pmd-pom-test/pom.xml
pmd-bin-6.10.0/bin$ ./run.sh pmd -no-cache -d ~/pmd-pom-test/ -R category/pom/errorprone.xml/ProjectVersionAsDependencyVersion
Doesn't show any violations.
Renaming the file to xml.pom (or really anything ending with .pom) does report the violation:
# does report the dependency version in ~/pmd-pom-test/xml.pom
pmd-bin-6.10.0/bin$ ./run.sh pmd -no-cache -d ~/pmd-pom-test/ -R category/pom/errorprone.xml/ProjectVersionAsDependencyVersion
/home/kris/pmd-pom-test/xml.pom:11: Do not use project.version to express a dependency version.
Running PMD through: CLI
Affects PMD Version:
6.10.0
Rule:
all rules for "Maven POM", tested with ProjectVersionAsDependencyVersion
Description:
When running PMD on Maven POM files (by convention named
pom.xml), the files aren't being picked up for validation.The
PomLanguageModuleseems to define Maven POM files as XML files having a "pom" extension.Is there a configuration that makes PMD pick up a
pom.xmlinstead of looking for asomething.pom?Code Sample demonstrating the issue:
Given this example
pom.xml(a failing example taken from the PMD unit tests)and running PMD with
Doesn't show any violations.
Renaming the file to
xml.pom(or really anything ending with.pom) does report the violation:Running PMD through: CLI