4

当我通过 Maven 在我的项目上运行FindBugs时,我得到了很多这些:

Can't use annotations when running in JDK 1.4 mode!

我该如何解决?在手册中找不到任何内容。

4

2 回答 2

4

我相信您在插件配置中缺少 targetJdk 元素,如下面的片段所示。

   <reporting>
     <plugins>
       <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.0.1</version>
        <configuration>
          <targetJdk>1.5</targetJdk>
        </configuration>
       </plugin>
     </plugins>
   </reporting>
于 2010-07-14T18:47:55.263 回答
-1

确保您的 Maven 构建插件编译为 1.5,而不是 1.4。

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
于 2010-07-14T15:47:49.297 回答