Building the OpenDA Java source code
This page describes how to build the OpenDA Java source code. These sources are located in the
core/java
directory of the source distribution, but when building everything,
ant
can be run from the OpenDA root directory (it will use the
build.xml
file located there).
Introduction
OpenDA software consists of four different modules. The first module is the core module, which contains the core of OpenDA software.
The three other modules are named after the components of data assimilation: models, observers, and algorithms. Each of these
modules contains all programs and files related to the respective data assimilation component. The core module contains programs,
which interface the other three modules. Modules for larger models with real applications are stored separately.
Native libraries, written e.g. in C or Fortran are provided both as source and binaries with OpenDA. By default the build processes
use the binaries. All binaries provided are 32-bit and therefore need a 32-bit version of Java. You can recompile the required
native libraries as 64-bit if needed, for which you will need a 64-bit version of Java. For some blackbox-wrappers en small models
you may not need any native libraries, so both 32-bit and 64-bit Java can be used.
Installation of Ant
To build OpenDA software, a command-line tool ant is used. Ant is similar to make, but written in Java, so that it is portable
between different platforms. If ant is not installed in your computer yet, you can download it from
ant.apache.org/bindownload.cgi
. For Linux users it is probably easier to use their package manager to install ant. Before installing ant, please check that a
recent 32-bit version of Java is installed (which can be downloaded from
www.java.com/download
or in case of Linux, installed with the package manager).
Build commands
For the following description it is assumed that the OpenDA source is available in a directory named
<path_to_openda>/public
.
Start by opening a command window (Windows) or a command shell (Linux) and change directory to the OpenDA main directory.
Compiling OpenDA
From the OpenDA main directory, you can compile all modules at once. Besides compilation there are several other options:
- ant (without any argument): to show help with list of possible ant arguments (the same as ant help).
- ant build: to compile OpenDA, make jar files and copy resources. This doesn't generate Javadoc documentation.
- ant doc: to build Javadoc for all modules and collect this documentation.
- ant clean: to remove the generated files.
- ant zip: to compile OpenDA, collect documentation and xml-schemas and create a set of zip files which contain
the subversion revision number in the filename as well as in the name of the readme file. This makes it easy to wrap everything
for exporting to a website or user. Exports with the same version numbers will extract to the same openda_<version>
directory, but new versions can coexist.
- ant zip-tests: to create zip files for the various test cases. Each case is stored as separate zip file. Each
file is named after the case followed by the version number.
Compiling individual modules
From the module directory, you can compile a single module. Within a module directory the build file has somewhat different options:
- ant (without any argument): to show help with list of possible ant arguments.
- ant build: to compile the module, make jar files and copy resources. This doesn't generate Javadoc
documentation.
- ant javadoc: to build Java doc.
- ant clean: to remove the generated files.
- ant make-standalone copy required external binaries to the module directory.
Compiling stand-alone modules
when providing others with a stand-alone module, you will have to provide other modules your stand-alone module depends upon (if
any). The easiest way to achieve this, is by using ant make-standalone (after building all OpenDA modules) in the module
directory. This will copy the files needed to the module directory.
Directory structure
Upon the execution of the command ant build or ant doc , the following folders are created in the main directory:
- bin: contains all binary files required for running OpenDA. This will be the content of OpenDA distribution
file.
- doc: contains OpenDA documentation, including some examples.
- xmlSchemas: contains the XML Schema files for the OpenDA configuration files.
Each module directory has the following structure:
- bin: contains all binary files related to the respective module.
- build: contains the class files resulting from compiling the Java files of the respective module.
- javadoc: will contain Java documentation files when they are generated by executing ant javadoc on the
command-line.
Removal of generated files
To remove the files generated by a build, you can use ant clean on the command-line. From within a module directory, this
command will remove the bin , build and javadoc directories, and the MANIFEST.MF file. It does
not affect other modules nor the folder bin in the OpenDA main directory. Executing the command line ant clean
from the OpenDA main directory will delete the folders bin , doc , and xmlSchemas in the main directory,
as well as removing all modules' generated files. Note: to be able to delete files, they cannot be in use (obviously), so close them
first.