?? manual.xml
字號:
<sect2 id="directInvocation"> <title>Direct invocation of &FindBugs;</title> <para> The preferred method of running &FindBugs; is to directly execute <filename>&FBHome;/lib/findbugs.jar</filename> using the <command>-jar</command> command line switch of the JVM (<command>java</command>) executable. (Versions of &FindBugs; prior to 1.3.5 required a wrapper script to invoke &FindBugs;.) </para> <para> The general syntax of invoking &FindBugs; directly is the following:<screen> <command>java <replaceable>[JVM arguments]</replaceable> -jar &FBHome;/lib/findbugs.jar <replaceable>options...</replaceable></command></screen> </para><!-- <para> By default, executing <filename>findbugs.jar</filename> runs the &FindBugs; graphical user interface (GUI). On windows systems, you can double-click on <filename>findbugs.jar</filename> to launch the GUI. From a command line, the command <screen>java -jar <replaceable>&FBHome;</replaceable>/lib/findbugs.jar</screen> will launch the GUI. </para>--> <sect3 id="chooseUI"> <title>Choosing the User Interface</title> <para> The first command line option chooses the &FindBugs; user interface to execute. Possible values are: </para> <itemizedlist> <listitem> <para> <command>-gui</command>: runs the graphical user interface (GUI) </para> </listitem> <listitem> <para> <command>-textui</command>: runs the command line user interface </para> </listitem> <listitem> <para> <command>-version</command>: displays the &FindBugs; version number </para> </listitem> <listitem> <para> <command>-help</command>: displays help information for the &FindBugs; command line user interface </para> </listitem> <listitem> <para> <command>-gui1</command>: executes the original (obsolete) &FindBugs; graphical user interface </para> </listitem> </itemizedlist> </sect3> <sect3 id="jvmArgs"> <title>Java Virtual Machine (JVM) arguments</title> <para> Several Java Virtual Machine arguments are useful when invoking &FindBugs;. </para> <variablelist> <varlistentry> <term><command>-Xmx<replaceable>NN</replaceable>m</command></term> <listitem> <para> Set the maximum Java heap size to <replaceable>NN</replaceable> megabytes. &FindBugs; generally requires a large amount of memory. For a very large project, using 1500 megabytes is not unusual. </para> </listitem> </varlistentry> <varlistentry> <term><command>-D<replaceable>name</replaceable>=<replaceable>value</replaceable></command></term> <listitem> <para> Set a Java system property. For example, you might use the argument <command>-Duser.language=ja</command> to display GUI messages in Japanese. </para> </listitem> </varlistentry> <!-- <varlistentry> <term></term> <listitem> <para> </para> </listitem> </varlistentry> --> </variablelist> </sect3> </sect2> <sect2 id="wrapperScript"> <title>Invocation of &FindBugs; using a wrapper script</title> <para> Another way to run &FindBugs; is to use a wrapper script. </para><para>On Unix-like systems, use the following command to invoke the wrapper script:<screen><prompt>$ </prompt><command>&FBHome;/bin/findbugs <replaceable>options...</replaceable></command></screen></para><para>On Windows systems, the command to invoke the wrapper script is <screen><prompt>C:\My Directory></prompt><command>&FBHomeWin;\bin\findbugs.bat <replaceable>options...</replaceable></command></screen></para><para>On both Unix-like and Windows systems, you can simply add the <filename><replaceable>$FINDBUGS_HOME</replaceable>/bin</filename>directory to your <filename>PATH</filename> environment variable and then invokeFindBugs using the <command>findbugs</command> command.</para> <sect3 id="wrapperOptions"> <title>Wrapper script command line options</title> <para>The &FindBugs; wrapper scripts support the following command-line options. Note that these command line options are <emphasis>not</emphasis> handled by the &FindBugs; program per se; rather, they are handled by the wrapper script. </para> <variablelist> <varlistentry> <term><command>-jvmArgs <replaceable>args</replaceable></command></term> <listitem> <para> Specifies arguments to pass to the JVM. For example, you might want to set a JVM property:<screen><prompt>$ </prompt><command>findbugs -textui -jvmArgs "-Duser.language=ja" <replaceable>myApp.jar</replaceable></command></screen> </para> </listitem> </varlistentry> <varlistentry> <term><command>-javahome <replaceable>directory</replaceable></command></term> <listitem> <para> Specifies the directory containing the JRE (Java Runtime Environment) to use to execute &FindBugs;. </para> </listitem> </varlistentry> <varlistentry> <term><command>-maxHeap <replaceable>size</replaceable></command></term> <listitem> <para> Specifies the maximum Java heap size in megabytes. The default is 256. More memory may be required to analyze very large programs or libraries. </para> </listitem> </varlistentry> <varlistentry> <term><command>-debug</command></term> <listitem> <para> Prints a trace of detectors run and classes analyzed to standard output. Useful for troubleshooting unexpected analysis failures. </para> </listitem> </varlistentry> <varlistentry> <term><command>-property</command> <replaceable>name=value</replaceable></term> <listitem> <para> This option sets a system property. &FindBugs; uses system properties to configure analysis options. See <xref linkend="analysisprops"/>. You can use this option multiple times in order to set multiple properties. Note: In most versions of Windows, the <replaceable>name=value</replaceable> string must be in quotes. </para> </listitem> </varlistentry> </variablelist> </sect3></sect2></sect1><sect1 id="commandLineOptions"><title>Command-line Options</title><!--<para>There are two ways to invoke &FindBugs;. The first invokes the the Graphical User Interface (GUI):<screen><prompt>$ </prompt><command>findbugs <replaceable>[standard options]</replaceable> <replaceable>[GUI options]</replaceable></command></screen>The second invokes the Command Line Interface (Text UI):<screen><prompt>$ </prompt><command>findbugs -textui <replaceable>[standard options]</replaceable> <replaceable>[Text UI options]</replaceable></command></screen></para>--><para> This section describes the command line options supported by &FindBugs;. These command line options may be used when invoking &FindBugs; directly, or when using a wrapper script.</para><sect2><title>Common command-line options</title><para>These options may be used with both the GUI and command-line interfaces.</para><variablelist> <varlistentry> <term><command>-effort:min</command></term> <listitem> <para> This option disables analyses that increase precision but also increase memory consumption. You may want to try this option if you find that &FindBugs; runs out of memory, or takes an unusually long time to complete its analysis. </para> </listitem> </varlistentry> <varlistentry> <term><command>-effort:max</command></term> <listitem> <para> Enable analyses which increase precision and find more bugs, but which may require more memory and take more time to complete. </para> </listitem> </varlistentry> <varlistentry> <term><command>-project</command> <replaceable>project</replaceable></term> <listitem> <para> Specify a project to be analyzed. The project file you specify should be one that was created using the GUI interface. It will typically end in the extension <filename>.fb</filename> or <filename>.fbp</filename>. </para> </listitem> </varlistentry> <!-- <varlistentry> <term><command></command></term> <listitem> <para> </para> </listitem> </varlistentry> --></variablelist></sect2><sect2><title>GUI Options</title><para>These options are only accepted by the Graphical User Interface.<variablelist> <varlistentry> <term><command>-look:</command><replaceable>plastic|gtk|native</replaceable></term> <listitem> <para> Set Swing look and feel. </para> </listitem> </varlistentry></variablelist></para></sect2><sect2><title>Text UI Options</title><para>These options are only accepted by the Text User Interface.</para><variablelist> <varlistentry> <term><command>-sortByClass</command></term> <listitem> <para> Sort reported bug instances by class name. </para> </listitem> </varlistentry> <varlistentry> <term><command >-include</command> <replaceable>filterFile.xml</replaceable></term> <listitem> <para> Only report bug instances that match the filter specified by <replaceable>filterFile.xml</replaceable>. See <xref linkend="filter" />. </para> </listitem> </varlistentry> <varlistentry> <term><command >-exclude</command> <replaceable>filterFile.xml</replaceable></term> <listitem> <para> Report all bug instances except those matching the filter specified by <replaceable>filterFile.xml</replaceable>. See <xref linkend="filter" />. </para> </listitem> </varlistentry> <varlistentry> <term><command>-onlyAnalyze</command> <replaceable>com.foobar.MyClass,com.foobar.mypkg.*</replaceable></term> <listitem> <para> Restrict analysis to find bugs to given comma-separated list of classes and packages. Unlike filtering, this option avoids running analysis on classes and packages that are not explicitly matched: for large projects, this may greatly reduce the amount of time needed to run the analysis. (However, some detectors may produce inaccurate results if they aren't run on the entire application.) Classes should be specified using their full classnames (including package), and packages should be specified in the same way they would in a Java <literal>import</literal> statement to import all classes in the package (i.e., add <literal>.*</literal> to the full name of the package). Replace <literal>.*</literal> with <literal>.-</literal> to also analyze all subpackages. </para> </listitem> </varlistentry> <varlistentry> <term><command>-low</command></term> <listitem> <para> Report all bugs. </para> </listitem> </varlistentry> <varlistentry> <term><command>-medium</command></term> <listitem> <para> Report medium and high priority bugs. This is the default setting. </para> </listitem> </varlistentry> <varlistentry> <term><command>-high</command></term> <listitem> <para> Report only high priority bugs. </para> </listitem> </varlistentry> <varlistentry> <term><command>-relaxed</command></term> <listitem> <para> Relaxed reporting mode. For many detectors, this option suppresses the heuristics used to avoid reporting false positives. </para> </listitem> </varlistentry> <varlistentry> <term><command>-xml</command></term> <listitem> <para> Produce the bug reports as XML. The XML data produced may be viewed in the GUI at a later time. You may also specify this
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -