Table of Contents
This chapter describes how to build FindBugs from source code. Unless you are interesting in modifying FindBugs, you will probably want to skip to the next chapter.
To compile FindBugs from source, you will need the following:
Apache Ant, version 1.6.3 or later
Warning | |
---|---|
The version of Ant included as |
If you want to be able to generate formatted versions of the FindBugs documentation, you will also need the following software:
The DocBook XSL Stylesheets. These are required to convert the FindBugs manual into HTML format.
The Saxon XSLT Processor. (Also required for converting the FindBugs manual to HTML.)
After you download the source distribution, you'll need to extract it into a working directory. A typical command to do this is:
$
unzip findbugs-2.0.3-source.zip
If you intend to build the FindBugs documentation,
you will need to modify the local.properties
file
used by the Ant
build.xml
file to build FindBugs.
If you do not want to build the FindBugs documentation, then you
can ignore this file.
The local.properties
overrides definitions
in the build.properties
file.
The build.properties
file looks something like this:
# User Configuration: # This section must be modified to reflect your system. local.software.home =/export/home/daveho/linux # Set this to the directory containing the DocBook Modular XSL Stylesheets # from http://docbook.sourceforge.net/projects/xsl/ xsl.stylesheet.home =${local.software.home}/docbook/docbook-xsl-1.71.1 # Set this to the directory where Saxon (http://saxon.sourceforge.net/) # is installed. saxon.home =${local.software.home}/java/saxon-6.5.5
The xsl.stylesheet.home
property specifies the full
path to the directory where you have installed the
DocBook Modular XSL
Stylesheets. You only need to specify this property if you will be
generating the FindBugs documentation.
The saxon.home
property is the full path to the
directory where you installed the Saxon XSLT Processor.
You only need to specify this property if you will be
generating the FindBugs documentation.
Once you have extracted the source distribution,
made sure that Ant is installed,
modified build.properties
(optional),
and configured the tools (such as Saxon),
you are ready to build FindBugs. Invoking Ant is a simple matter
of running the command
$
anttarget
where target
is one of the following:
This target compiles the code for FindBugs. It is the default target.
This target formats the documentation. (It also compiles some of the source code as a side-effect.)
This target compiles and runs the internal JUnit tests included in FindBugs. It will print an error message if any unit tests fail.
Builds a binary distribution of FindBugs.
The target creates both .zip
and
.tar.gz
archives.
After running an Ant command, you should see output similar to the following (after some other messages regarding the tasks that Ant is running):
BUILD SUCCESSFUL
Total time: 17 seconds
The Ant build script for FindBugs is written such that after building the build target, the working directory is set up just like a binary distribution. So, the information about running FindBugs in Chapter 4, Running FindBugs™ applies to source distributions, too.