By default, the maven-pmd-plugin only supports the languages Java, JavaScript and JSP. But CPD supports many more languages, e.g. C#. In order to enable C# in your build, you need to configure several parts:
cs
.*.cs
(otherwise only java files will be analyzed)src/main/java
is analyzed)
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.27.0</version>
<configuration>
<language>cs</language>
<minimumTokens>10</minimumTokens>
<includes>
<include>**/*.cs</include>
</includes>
<compileSourceRoots>
<compileSourceRoot>${basedir}/src/main/cs</compileSourceRoot>
</compileSourceRoots>
<printFailingErrors>true</printFailingErrors>
</configuration>
<executions>
<execution>
<goals>
<goal>cpd-check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-cs</artifactId>
<version>7.14.0</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
</build>
</project>
In this example, the C# source files are located in src/main/cs
.
Note: The version for net.sourceforge.pmd:pmd-cs
needs to match the PMD version. If you upgrade PMD at runtime, you need to change the version here as well.
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