Finding duplicated code in C#

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:

  • Add an additional plugin dependency for c# (pmd-cs module)
  • Select the language cs.
  • Configure the includes filter to consider *.cs (otherwise only java files will be analyzed)
  • Configure the source directory (by default, only src/main/java is analyzed)

    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, that is being used. If you upgrade PMD at runtime you'll need to make sure, to change the version here as well.