15.3 Development

Compiling GeoNetwork

To compile GeoNetwork you first need to install the source code during installation. If you do so, you get a build.xml script and a src folder with the full source.

You also need the Ant tool to run the build script. You can download Ant from http://ant.apache.org. Version 1.6.5 works but any other recent version should be ok. Once installed, you should have the ant command in your path (on Windows systems, you have to open a shell to check).

When all is in place, go inside the GeoNetwork’s root folder (the one where the build.xml file is located) and issue the ant command. You should see an output like this one:

gemini:/geonetwork/trunk# ant 
Buildfile: build.xml 
compile: 
[delete] Deleting: /geonetwork/trunk/web/WEB-INF/lib/geonetwork.jar 
[delete] Deleting: /geonetwork/trunk/csw/lib/csw-client.jar 
[delete] Deleting: /geonetwork/trunk/csw/lib/csw-common.jar 
[delete] Deleting: /geonetwork/trunk/gast/gast.jar 
[mkdir] Created dir: /geonetwork/trunk/.build 
[javac] Compiling 267 source files to /geonetwork/trunk/.build 
[javac] Note: Some input files use or override a deprecated API. 
[javac] Note: Recompile with -Xlint:deprecation for details. 
[javac] Note: Some input files use unchecked or unsafe operations. 
[javac] Note: Recompile with -Xlint:unchecked for details. 
[copy] Copying 1 file to /geonetwork/trunk/.build 
[jar] Building jar: /geonetwork/trunk/web/WEB-INF/lib/geonetwork.jar 
[jar] Building jar: /geonetwork/trunk/csw/lib/csw-client.jar 
[jar] Building jar: /geonetwork/trunk/csw/lib/csw-common.jar 
[jar] Building jar: /geonetwork/trunk/gast/gast.jar 
[delete] Deleting directory /geonetwork/trunk/.build 
BUILD SUCCESSFUL 
Total time: 9 seconds 
gemini:/geonetwork/trunk#

The compilation phase, if it has success, puts all jars into the proper place (most of them will be copied into web/geonetwork/WEB-INF/lib and web/intermap/WEB-INF/lib). After this phase, simply restart GeoNetwork to see the effects.

Source code documentation

The GeoNetwork Java source code is based on Javadoc. Javadoc is a tool for generating API documentation in HTML format from doc comments in source code. To see documentation generated by the Javadoc tool, go to:

Creating the installer

You can generate an installer by running the ant command inside the installer directory.

Both platform independent and Windows specific installers are generated by default.

Make sure you update version number and other relevant properties in the installer/build.xml file

You can also create an installer that includes a Java Runtime Environment (JRE) for Windows. This will allow GeoNetwork to run on a compatible, embedded JRE and thus avoid error messages caused by JRE incompatibilities on the PC.

Creating an installer with an embedded JRE requires you to first download and unzip the JRE in a folder jre1.5.0_12 at the project root level. Refer to the installer-config-win-jre.xml file for exact configuration.


Other documents: The complete manual in pdf format | License | Readme | Changes