Class FindBugsViewerTask

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class FindBugsViewerTask
    extends org.apache.tools.ant.Task
    FindBugsViewerTask.java -- Ant Task to launch the FindBugsFrame To use, create a new task that references the ant task (such as "findbugs-viewer"). Then call this task while passing in parameters to modify it's behaviour. It supports several options that are the same as the findbugs task: -projectFile -debug -jvmargs -home -classpath -pluginList -timeout It also adds some new options: -look: string name representing look and feel. Can be "native", "plastic" or "gtk" -loadbugs: file name of bug report to load The below is an example of how this could be done in an ant script: <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="C:\dev\cvs.sourceforge.net\findbugs\lib\findbugs-ant.jar" /> <taskdef name="findbugs-viewer" classname="edu.umd.cs.findbugs.anttask.FindBugsViewerTask" classpath="C:\dev\cvs.sourceforge.net\findbugs\lib\findbugs-ant.jar" /> <property name="findbugs.home" location="C:\dev\cvs.sourceforge.net\findbugs" /> <property name="findbugs.bugReport" location="bcel-fb.xml" /> <target name="findbugs-viewer" depends="jar"> <findbugs-viewer home="${findbugs.home}" look="native" loadbugs="${findbugs.bugReport}"/> </target> Created on March 21, 2006, 12:57 PM
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.apache.tools.ant.types.Path classpath  
      private boolean debug  
      private static long DEFAULT_TIMEOUT  
      private org.apache.tools.ant.taskdefs.Java findbugsEngine  
      private java.io.File homeDir  
      private java.lang.String jvmargs  
      private java.io.File loadbugs  
      private java.lang.String look  
      private org.apache.tools.ant.types.Path pluginList  
      private java.io.File projectFile  
      private long timeout  
      • Fields inherited from class org.apache.tools.ant.Task

        target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Constructor Summary

      Constructors 
      Constructor Description
      FindBugsViewerTask()
      Creates a new instance of FindBugsViewerTask
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addArg​(java.lang.String arg)
      Add an argument to the JVM used to execute FindBugs.
      org.apache.tools.ant.types.Path createClasspath()
      Path to use for classpath.
      org.apache.tools.ant.types.Path createPluginList()
      Path to use for plugin list.
      void execute()  
      void setClasspathRef​(org.apache.tools.ant.taskdefs.Ant.Reference r)
      Adds a reference to a classpath defined elsewhere.
      void setDebug​(boolean flag)
      Set the debug flag
      void setHome​(java.io.File homeDir)
      Set the home directory into which spotbugs was installed
      void setJvmargs​(java.lang.String args)
      Set any specific jvm args
      void setLoadbugs​(java.io.File loadbugs)
      Sets the file that contains the XML output of a findbugs report.
      void setLook​(java.lang.String look)
      Set look.
      void setPluginList​(org.apache.tools.ant.types.Path src)
      the plugin list to use.
      void setPluginListRef​(org.apache.tools.ant.taskdefs.Ant.Reference r)
      Adds a reference to a plugin list defined elsewhere.
      void setProjectFile​(java.io.File projectFile)
      Set the project file
      void setTimeout​(long timeout)
      Set timeout in milliseconds.
      • Methods inherited from class org.apache.tools.ant.Task

        bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • debug

        private boolean debug
      • projectFile

        private java.io.File projectFile
      • loadbugs

        private java.io.File loadbugs
      • timeout

        private long timeout
      • jvmargs

        private java.lang.String jvmargs
      • look

        private java.lang.String look
      • homeDir

        private java.io.File homeDir
      • classpath

        private org.apache.tools.ant.types.Path classpath
      • pluginList

        private org.apache.tools.ant.types.Path pluginList
      • findbugsEngine

        private org.apache.tools.ant.taskdefs.Java findbugsEngine
    • Constructor Detail

      • FindBugsViewerTask

        public FindBugsViewerTask()
        Creates a new instance of FindBugsViewerTask
    • Method Detail

      • setLoadbugs

        public void setLoadbugs​(java.io.File loadbugs)
        Sets the file that contains the XML output of a findbugs report.
        Parameters:
        loadbugs - XML output from a findbugs session
      • setProjectFile

        public void setProjectFile​(java.io.File projectFile)
        Set the project file
        Parameters:
        projectFile - project file
      • setDebug

        public void setDebug​(boolean flag)
        Set the debug flag
        Parameters:
        flag - true to enable debugging
      • setJvmargs

        public void setJvmargs​(java.lang.String args)
        Set any specific jvm args
        Parameters:
        args - specific jvm args
      • setLook

        public void setLook​(java.lang.String look)
        Set look. One of "native", "gtk" or "plastic"
        Parameters:
        look - One of "native", "gtk" or "plastic
      • setHome

        public void setHome​(java.io.File homeDir)
        Set the home directory into which spotbugs was installed
        Parameters:
        homeDir - home directory into which spotbugs was installed
      • createClasspath

        public org.apache.tools.ant.types.Path createClasspath()
        Path to use for classpath.
        Returns:
        classpath
      • setClasspathRef

        public void setClasspathRef​(org.apache.tools.ant.taskdefs.Ant.Reference r)
        Adds a reference to a classpath defined elsewhere.
        Parameters:
        r - reference to a classpath defined elsewher
      • setPluginList

        public void setPluginList​(org.apache.tools.ant.types.Path src)
        the plugin list to use.
        Parameters:
        src - plugin list to use
      • createPluginList

        public org.apache.tools.ant.types.Path createPluginList()
        Path to use for plugin list.
        Returns:
        plugin list
      • setPluginListRef

        public void setPluginListRef​(org.apache.tools.ant.taskdefs.Ant.Reference r)
        Adds a reference to a plugin list defined elsewhere.
        Parameters:
        r - reference to a plugin list defined elsewhere
      • setTimeout

        public void setTimeout​(long timeout)
        Set timeout in milliseconds.
        Parameters:
        timeout - the timeout
      • addArg

        private void addArg​(java.lang.String arg)
        Add an argument to the JVM used to execute FindBugs.
        Parameters:
        arg - the argument
      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException