Eclipse+FindBugs - exclude filter files doesn't work

让人想犯罪 __ 提交于 2019-11-30 09:45:02

Following the directives from Jenkins I created a findbugs-exclude.xml in my android workspace and added it via Eclipse -> Window -> Preferences -> Java -> FindBugs -> Filter files -> "Add..." button near the "Exclude filter files" section to findbugs. My first error was that I ticked the first checkbox (the include filter :-) section).

Then I started manually findbugs and everything was ok. The content of my file is:

<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
    <Match>
        <Class name="~.*\.R\$.*"/>
    </Match>
    <Match>
    <Class name="~.*\.Manifest\$.*"/>
    </Match>
</FindBugsFilter>

I am using eclipse 3.7.1 and findbugs 1.3.9. Hope that helps.

I just want to remind newbie that "Default Settings" is apply on new project, so you can't just exclude your filter in "Default Settings" if you want to apply it in current project:

instead you should exclude your filter in "Settings":

btw, once plugin installed and restart, Android Studio may pop up dialog on right bottom, you just have to click that link Add R.class File Filter, it will automatically generate the correct xml code for you.

Filter file may be ignored silently when path to file is incorrect or when XML file is not valid. Try to validate filter using XSD from https://raw.githubusercontent.com/findbugsproject/findbugs/master/findbugs/etc/findbugsfilter.xsd .

Had this problem on Eclipse 4.4.2.

Please delete the error manually. Select the error and right click, select Delete. Then rebuild your project.

It could be that findbugs is ignoring the file correctly, but that doesn't mean that the errors it has previously raised on the file get deleted, they still exist, and you have to delete them manually.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!