日食+ FindBugs的 - 排除过滤器文件不起作用 [英] Eclipse+FindBugs - exclude filter files doesn't work
问题描述
我使用Windows和Eclipse 3.7经典与ADT插件为Android开发。
I'm using Windows and Eclipse 3.7 Classic with ADT plugin for Android development.
我刚刚安装FindBugs的,它发现在自动生成的R.java类的错误。
I've just installed FindBugs and it have found a bug in auto-generated R.java class.
我想从FindBugs的检查,排除此类。
I want to exclude this class from FindBugs checks.
我发现我可以定义排除过滤器在XML文件中的FindBugs,所以我创建了一个文件D:\项目\日食\ FindBugsExculde.xml文本
I've found that I can define exclude filters for FindBugs in xml file, so I've created a file D:\Projects\eclipse\FindBugsExculde.xml with text
<FindBugsFilter>
<Match>
<Class name="com.android.demo.notepad3.R$attr" />
</Match>
</FindBugsFilter>
我添加文件到Eclipse - >窗口 - > preferences - >爪哇 - > FindBugs的 - >过滤文件 - >添加...按钮,在排除筛选文件部分附近
I've added this file to Eclipse -> Window -> Preferences -> Java -> FindBugs -> Filter files -> "Add..." button near the "Exclude filter files" section.
但是,当我在我的项目上单击右键,选择查找错误 - >查找错误我仍然看到错误
But when I right-click on my project and select "Find Bugs" -> "Find Bugs" I still see the error
The class name com.android.demo.notepad3.R$attr doesn't start with an upper case letter
我甚至试图取代
I have even tried to replace
<Class name="com.android.demo.notepad3.R$attr" />
与
<Class name="~.*" />
但还是错误是存在的。
but still the error is there.
我试图重新启动Eclipse - 没有运气。我甚至想,也许有在FindBugs的,因此不使用规定,但Procmon.exe从SysinternalsSuite表明,它确实我每次执行FindBugs的时候使用它的文件中的错误:
I tried to restart Eclipse - no luck. I even thought that maybe there is a Bug in FindBugs so it doesn't use the file specified but Procmon.exe from SysinternalsSuite shows that it do use it each time I execute FindBugs:
ProcessName Operation Path Result
javaw.exe QueryOpen D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
javaw.exe QueryOpen D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
javaw.exe CreateFile D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
javaw.exe CreateFile D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
javaw.exe QueryFileInternalInformationFile D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
javaw.exe CloseFile D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
javaw.exe ReadFile D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
javaw.exe CloseFile D:\Projects\eclipse\FindBugsExculde.xml SUCCESS
我是什么做错了吗?请帮帮我!
What am I doing wrong? Please help me!
推荐答案
这是继指令<一href="https://wiki.jenkins-ci.org/display/JENKINS/Building+an+Android+app+and+test+project#BuildinganAndroidappandtestproject-FindBugs">Jenkins我在我的Android工作区中创建一个 FindBugs的-exclude.xml
并通过Eclipse把它添加 - >窗口 - > preferences - >爪哇 - > FindBugs的 - >筛选器文件 - >添加...按钮,在排除过滤器文件部分,以FindBugs的附近。我的第一个错误是我选中第一个复选框(包括筛选:-)部分)。
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).
然后我手动启动FindBugs的,一切都OK。我的文件的内容是:
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>
我使用的Eclipse 3.7.1和1.3.9的FindBugs。希望有所帮助。
I am using eclipse 3.7.1 and findbugs 1.3.9. Hope that helps.
这篇关于日食+ FindBugs的 - 排除过滤器文件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!