Java 逐步抑制findbugs警告

Java 逐步抑制findbugs警告,java,maven,maven-2,findbugs,suppress-warnings,Java,Maven,Maven 2,Findbugs,Suppress Warnings,我想通过在方法开头之前输入以下行来抑制单个Findbug警告(“将非恒定字符串传递给SQL语句上的execute方法”): @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = {"SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE", "SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" }, justification = "just a

我想通过在方法开头之前输入以下行来抑制单个Findbug警告(“将非恒定字符串传递给SQL语句上的execute方法”):

@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = {"SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE", "SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" }, justification = "just a test")
但是Eclipse一直说edu不能解析为类型,并且注释类型的属性对正未定义。 在findbugs文档中,我读到我必须在Java构建路径(在项目属性中)中添加annotations.jar和jsr305.jar。但是在findbugs文件夹中,我找不到任何.jar文件。仅findbugs.xml、findbugs-excludes.xml等

我该怎么做才能让它运行?我使用Findbugs maven插件2.5.2


多谢各位

下载并添加到您的类路径:

http://www.java2s.com/Code/Jar/a/Downloadannotations201jar.htm
或者使用官方maven存储库:

<dependency>
    <groupId>findbugs</groupId>
    <artifactId>findbugs</artifactId>
    <version>1.0.0</version>
</dependency>

芬德布格斯

或者使用以下maven代码段:

<dependency>
    <groupId>com.kenai.nbpwr</groupId>
    <artifactId>edu-umd-cs-findbugs-annotations</artifactId>
    <version>unknown</version>
</dependency>

com.kenai.nbpwr
edu umd cs findbugs注释
未知的

。我将其添加到findbugs-maven-plugin-2.5.2.pom中,但edu仍然无法解析为类型如果使用
SuppressFBWarnings
,则不必完全限定它。