eclipse中的PMD不接受排除模式 [英] PMD in eclipse does not accept exclude-pattern

查看:137
本文介绍了eclipse中的PMD不接受排除模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在eclipse 4.3.1 / Kepler下使用PMD,我无法从违规检查中排除文件和文件夹。

I am using PMD under eclipse 4.3.1 / Kepler and I cannot exclude files and folders from the violation check.

我的文件夹结构

/any/path/to/the/workspace/myproject1
/any/path/to/the/workspace/myproject2
/any/path/to/the/workspace/myprojectWithPMDrulesFile/pmd-rules.xml

现在在以下文件夹由testng生成

Now following folders get generated by testng

...../myproject1/test-output
...../myproject2/test-output

现在我已经配置了以下规则文件:

Now I have configured following rules file:

<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     name="Xeno-PMD-rules"
     xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
    <description>PMD Plugin preferences rule set</description>
    <exclude-pattern>.*/test-output/*.*</exclude-pattern>
    <exclude-pattern>/.*/test-output/.*</exclude-pattern>
    <exclude-pattern>**/test-output/**</exclude-pattern>
    <exclude-pattern>./test-output/.</exclude-pattern>
    <rule ref="rulesets/java/android.xml/CallSuperFirst"/>
    ...
</ruleset>

在我的情况下,jquery.js文件中有数百个错误,该文件处于测试输出中

In my case I have many hundred errors in the jquery.js file, which is in test-output.

我如何递归排除特定文件夹及其中的所有文件?

如何设置模式在Eclipse和ANT / maven下工作?

提示:似乎类似于: PMD排除不起作用

推荐答案

您几乎已经知道了!使用以下排除语法:

You almost got it already! Use the following exclusion syntax:

<exclude-pattern>.*/test-output/.*</exclude-pattern>

这将排除所有具有 / test-output / test-output

This will exclude all files that have /test-output/ somewhere in their absolute path. The pattern is the same in Eclipse and Ant/Maven, as long as the excluded folders are also called test-output.

其他说明和示例可以在 PMD文档中找到。

Additional explanations and examples can be found in the PMD documentation.

这篇关于eclipse中的PMD不接受排除模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆