Ant is an open source project building tool from the Apache organization. It is widely used to maintain java projects, although it can be used with non-java projects or element too..
The root of the SIP Communicator CVS repository holds a file called build.xml. Once you have populated your own Sandbox, you will find you have a copy of this file. It defines all the stages required to build, test and deploy the project. It also defines the dependencies between these stages, which are called “targets” by Ant.
Before you build SIP Communicator, you will need a current Java SDK (1.4.2 or above). You cannot run Ant with just a JRE (Java Runtime Environment), you must have a working SDK (Software Development Kit), which will include the java compiler and other associated tools. Ant is a pure java application, so it will run under almost any SDK. In general, you should get Ant working properly with a “safe and stable” Sun SDK (e.g. 1.4.2) before trying to convert to another SDK.
You will also need a current version of Ant. You should download and install it from http://ant.apache.org, then confirm it is properly configured.
The SIP Communicator build.xml file has many targets, but you can run the default target (called “ant-usage”) by changing to the Sandbox directory and simply issuing the following command:
ant
.. nothing will be changed in your sandbox, but you will see a brief list of the most useful ant commands.
Try this command next:
ant -projecthelp
.. your sandbox will still remain unchanged, but you will see a list of the most important individual “external” build targets. The build.xml file has many “internal” and “external” targets, but only the “external” ones will be listed.
For example, you can do a complete sequence of clean, compile, jar and test of the project by running this command:
ant rebuild test
.. although most of the time you will only need to perform an implicit incremental build to pick up your latest changes…
ant test
You can also run the SIP Communicator application in several ways:
ant run
.. is not necessarily what you would want. It runs the SIP Communicator gui against your last successful build, but will not check whether any dependent files require rebuilding. So, if you’ve made some important source changes or have picked up the latest source from CVS, you will be safer running this command instead:
ant make run
If you suspect an incremental build might not resolve all your dependencies, you can always take the safe option and execute:
ant rebuild run
If you would like to know more about the contents of the build.xml file, you should read Ant build targets.
We are starting the process of adding JUnit tests to the project. Currently, our Ant build.xml will detect whether you have a suitable JUnit environment and issue a warning if not found. If you would like to know more about our use of JUnit, see design of the JUnit tests.
If the Ant rebuild does not work perfectly, you will probably need to learn about diagnosing and fixing Ant problems. The FAQ’s on the Ant web site http://ant.apache.org are quite helpful, but you should not underestimate the complexity of what you are trying to do. The SIP Communicator project is always built for distribution with Ant, so you are almost certainly going to suffer from a problem configuring your own machine, rather than a problem in our Ant build file. Most first-time Ant build problems are resolved by careful attention to classpath and classloader issues.
Author: Brian Burch