# Building XOM

First you'll need to clone the source from Github. This unpacks into a directory named "xom".

XOM includes an Ant build file. You can build XOM with Ant 1.6 or later. Although all the code compiles back to Java 1.5, the build is targeted at Java 1.6 because it's hard to find a compiler that supports older versions these days.

Building XOM requires Apache Ant. If you don't already have it installed, download it from http://ant.apache.org/. Be sure to add the ant/bin directory to your path and point the ANT_HOME environment variable to wherever you've installed Ant, as explained in the Ant documentation. Also set the JAVA_HOME environment variable to the location of your JDK,

Once you've done this, just type "ant" in the XOM directory to see the list of available targets:

    [XOM]$ ant
    Buildfile: build.xml

    help:
         [echo]
         [echo] XOM Build file
         [echo] -------------------------------------------------------------
         [echo]
         [echo]   available targets are:
         [echo]
         [echo]     help      --> print this message
         [echo]     jar       --> build the xom.jar file
         [echo]     samples   --> build the xom-samples.jar file
         [echo]     compile   --> compile the source code
         [echo]     compile15 --> compile the classes that depend on Java 1.5
         [echo]     javadoc   --> generate the API documentation
         [echo]     betterdoc --> better formatted API documentation (requires Ant 1.6)
         [echo]     test      --> run JUnit test suite
         [echo]     testui    --> run Junit test suite in GUI
         [echo]     clean     --> clean up the build directory
         [echo]     dist      --> the zip and .tar.gz files
         [echo]
         [echo] -------------------------------------------------------------
         [echo]

    BUILD SUCCESSFUL
    Total time: 3 seconds

Most of these are self-explanatory. Typing "ant compile" compiles the source base into the directory build/classes. Typing ant jar compiles the files and stuffs them into a JAR archive. Typeing "ant javadoc" compiles the API documentation, etc. However, there are a couple of special cases to note:

Elliotte Rusty Harold
ERH
2004, 2023 Elliotte Rusty Harold