[ 
https://issues.apache.org/jira/browse/MPMD-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17188250#comment-17188250
 ] 

Andreas Dangel commented on MPMD-290:
-------------------------------------

So, it works with the following snippet:
{code:java}
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.13.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>6.21.0</version>
            </dependency>
        </dependencies>
      </plugin>
 {code}
 

The additional dependency is necessary, so that the correct tokenizer is used. 
Otherwise comments are not ignored and might be reported as duplicates.

I don't know, how this configuration interacts with other plugins, e.g. 
dotnet-maven-plugin.

So maybe, it's just a documentation issue in the end?

 

> CPD ignores the specified language
> ----------------------------------
>
>                 Key: MPMD-290
>                 URL: https://issues.apache.org/jira/browse/MPMD-290
>             Project: Maven PMD Plugin
>          Issue Type: Bug
>          Components: CPD
>    Affects Versions: 3.12.0
>            Reporter: QualiteSys QualiteSys
>            Assignee: Andreas Dangel
>            Priority: Major
>
> I wish to analyze C# source code with CPD, with no success
> Looking to the CpdReport.java MOJO, it seams that the language is not 
> extracted from either the pom.xml file or the CLI options.
> Line 76 :
>     @Parameter( defaultValue = "java" )
>      private String language;
> property = "language" is missing, so the language is always forced to java
> Is it possible to fix this bug, and add the missing languages CPD is 
> supporting ?
> Thanks
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to