FindBugs的问题与蚂蚁 [英] Findbugs issue with ant

查看:409
本文介绍了FindBugs的问题与蚂蚁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FindBugs的:

从ant任务

  [FindBugs的]执行的FindBugs
[FindBugs的]运行FindBugs的...
[FindBugs的] java.lang.NoClassDefFoundError的:组织/阿帕奇/ BCEL /类文件/ ClassFormtException
[FindBugs的]致:抛出java.lang.ClassNotFoundException:org.apache.bcel.classfile.ClassFormatException
[FindBugs的]在java.net.URLClassLoader的$ 1.run(URLClassLoader.java:202)
[FindBugs的]在java.security.AccessController.doPrivileged(本机方法)
[FindBugs的]在java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[FindBugs的]在java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[FindBugs的]在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:301)
[FindBugs的]在java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[FindBugs的]找不到主类:edu.umd.cs.findbugs.FindBugs2。计划将退出。
[FindBugs的]异常线程main

我得到这个问题上的蚂蚁FindBugs的执行虽然我保存在所需的文件夹FindBugs的和必要的jar文件。

我用FindBugs的1.3.2和5.2 BCEL

如何解决这个问题?

  [FindBugs的]输出保存到错误/报告/ findbugs.xml


解决方案

借助 FindBugs的文档规定如下:


  

请注意


  
  

我们强烈建议您使用Ant任务与它所包含的FindBugs的版本。我们不保证Ant任务Jar文件会比它被包含在一个其他的FindBugs任何版本。


您并不表明你正在使用Ant任务的版本...

我会建议使用像常春藤依赖经理如下打理复杂的类路径:

 <项目名称=演示默认值=FindBugs的的xmlns:常春藤=的antlib:org.apache.ivy.ant>    <目标名称=初始化描述=使用常春藤管理ANT任务>
        <常春藤:cachepath PATHID =findbugs.path>
            <com.google code.findbugs依赖组织= NAME =FindBugs的蚂蚁REV =2.0.1的conf =默认/>
        < /常春藤:cachepath>        <的taskdef NAME =FindBugs的类名=edu.umd.cs.findbugs.anttask.FindBugsTaskclasspathref =findbugs.path/>
    < /目标与GT;    <目标名称=FindBugs的取决于=初始化>
        ..
        < FindBugs的..
        ..
    < /目标与GT;< /项目>

最后,也是值得考虑rel=\"nofollow\">声纳使用

findbugs:

[findbugs] Executing findbugs from ant task
[findbugs] Running FindBugs...
[findbugs] java.lang.NoClassDefFoundError: org/apache/bcel/classfile/ClassFormtException
[findbugs] Caused by: java.lang.ClassNotFoundException: org.apache.bcel.classfile.ClassFormatException
[findbugs]     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[findbugs]     at java.security.AccessController.doPrivileged(Native Method)
[findbugs]     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[findbugs]     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[findbugs]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[findbugs]     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[findbugs] Could not find the main class: edu.umd.cs.findbugs.FindBugs2.  Program will exit.
[findbugs] Exception in thread "main"

I get this issue on executing findbugs with ant though I kept findbugs and essential jar files in the required folder.

I use findbugs 1.3.2 and bcel 5.2.

How to solve this issue ?

[findbugs] Output saved to bugs/reports/findbugs.xml

解决方案

The findbugs documentation states the following:

Note

It is strongly recommended that you use the Ant task with the version of FindBugs it was included with. We do not guarantee that the Ant task Jar file will work with any version of FindBugs other than the one it was included with.

You do not indicate which version of the ANT task you are using....

I would recommend using a dependency manager like ivy to take care of complex classpaths as follows:

<project name="demo" default="findbugs" xmlns:ivy="antlib:org.apache.ivy.ant">

    <target name="init" description="Use ivy to manage ANT tasks">
        <ivy:cachepath pathid="findbugs.path">
            <dependency org="com.google.code.findbugs" name="findbugs-ant" rev="2.0.1" conf="default"/>
        </ivy:cachepath>

        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.path"/>
    </target>

    <target name="findbugs" depends="init">
        ..
        <findbugs ..
        ..
    </target>

</project>

Finally, it is also worth considering the use of Sonar. The Sonar ANT task manages all the findbugs dependencies for you and also runs other tools like checkstyle and PMD.

这篇关于FindBugs的问题与蚂蚁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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