Menu

#789 Eclipse and Maven PMD plugins violations report differ

open
nobody
6
2012-10-07
2008-07-22
md
No

We use the same ruleset in our PMD and Eclipse plugins. However, the maven plugin reports violations that the Eclipse plugin doesn't. All of the rules in the ruleset have a priority of 1. There are some rules whose priority has bee raised from 1 to 3. The rule reporting violations in maven is one of those.

In maven, the plugin has been configured to use the ruleset using a url. In eclipse, the plugin has been configured by clearing all rules and importing the rules in the attached file.

Specifically, the one firing off in maven and not in eclipse is: AbstractClassWithoutAbstractMethod. I believe the maven plugin is doing it right.

I am attaching the ruleset file.

Discussion

  • md

    md - 2008-07-22

    Rule set of priority 1 rules to use in maven and eclipse

     
  • md

    md - 2008-07-22

    Logged In: YES
    user_id=233087
    Originator: YES

    The problem isn't so much that the reports ( it is ), but it is exacerbated by the fact that Eclipse is under-reporting. This causes developers to believe that they have cleared all violations and is ok to commit code to source control. Then maven finds these extra violations and the pmd:check goal breaks the builds. If it had been the other way around ( eclipse over-reporting ) it wouldn't have been as serious a problem ( would have resulted in code cleaner than expected ).

     
  • Ryan Gustafson

    Ryan Gustafson - 2008-07-22

    Logged In: YES
    user_id=342470
    Originator: NO

    Please provide the version of the Eclipse plugin being used, and the version of the Maven plugin being used.

    It is entirely possibe they use different versions of PMD under the hood, and thus have different behavior.

    Also, the PMD project does not maintain the Maven plugin, so there will be limits to what we can correct in that regard.

    Thanks,
    Ryan

     
  • Xavier Le Vourch

    Logged In: YES
    user_id=1373398
    Originator: NO

    As Ryan suggested, you'll need to provide more information on your maven and eclipse setups.

    A quick check indicates that the latest maven plugin uses PMD 4.2.2 and the latest eclipse plugin uses 4.2.1 so that may be part of the problem although the changelog doesn't mention anything related to the AbstractClassWithoutAbstractMethod rule but without more details, it's hard to tell what the real issue is as you may be using older versions of the plugins.

    Also providing a test case for which the output is different would help isolate the problem as if the issue still exists in the pmd code, we'll probably fix it before 4.2.3 is released, which shouldn't be too long from now. A test case would also help as we can then run the command line pmd for the two versions to check for differences.

    Xavier

     
  • md

    md - 2008-07-23

    Logged In: YES
    user_id=233087
    Originator: YES

    Hi,

    Thanks for the quick response. Here are the requested details:
    Eclipse: 3.4 (Ganymede) Build id: I20080617-2000
    PMD for Eclipse: v3.2.4.v200804111600
    PMD for Eclipse Core Plug-in: v4.2.1.v200804111600
    PMD for Eclipse Runtime Plug-in: v3.2.4.v200804111600
    PMD for Eclipse UI Plug-in: v3.2.4.v200804111600

    Maven: 2.0.9
    maven-pmd-plugin: v2.4 ( http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-pmd-plugin/2.4/maven-pmd-plugin-2.4.pom)

    I will try and come up with a test case.

    -Moiz

     

Log in to post a comment.