If you would like to deploy eXist into an existing servlet engine (e.g. tomcat), you will need a .war file. We no longer distribute a .war build, but it is easy to create one from the standard distribution by repackaging (not building) it:
Get a standard distribution from the download page. Install it into a directory of your choice. Make sure you include the source package.
Open a command line prompt and change to the directory where you just installed eXist. Call
or
once. This will generate a .war archive into directory dist.
Note that generating a WAR archive does only repackage the files in the distribution, so if the distribution worked properly for you, the WAR should as well. You don't need to recompile eXist or sign any jars.
Building eXist is quite easy and requires 3 simple steps:
The SVN URL for the development trunk is:
You need an SVN client to check out the source code. Examples for SVN clients are Tortoise SVN on the windows platform or the command line SVN tools on Unix (see below). The oXygen XML editor ships with its own SVN client.
Before starting the build, your JAVA_HOME environment variable should be set to point to the root directory of the JAVA JDK (note: JDK, not JRE!). Open a console or a DOS box on windows and type:
on windows or
on unix.
Change into the eXist directory you just checked out and call
on windows or on unix:
You can rebuild all eXist packages from the standard distribution or the subversion repository. You can even create a new distribution from the one you installed. For example, assume you installed eXist using the installer GUI, but you need to have an exist.war package for deployment within a different servlet engine. Just call the main build script (build.sh or build.bat) and pass it the target dist-war:
This will create a fresh .war archive in the dist directory.
To be able to use the build system, you need to include the "source" module when selecting installable packages in the installer GUI.
eXist relies on Ant for all compile and build tasks. Ant is included in the distribution (directory tools/ant). As already mentioned above, there are two shell scripts to start Ant: build.sh or build.bat. The shell scripts will take care to create a proper command line to launch Java with the Ant version included in the distribution.
Calling Ant without further argument will compile the sources and create the main jar-files (exist.jar, exist-optional.jar, start.jar).
lists the available build targets. Passing one of these as argument to ant will call execute the corresponding target. The main targets are:
| all | Compile the sources and create the main jar-files (exist.jar, exist-optional.jar, start.jar). |
||||||||||
| backrest | Create backrest zip | ||||||||||
| benchmark | Performs the benchmark tests for eXist. | ||||||||||
| clean | Cleans the files and directories generated by a previous build. | ||||||||||
| clean-all | Cleanup deeper | ||||||||||
| clean-conf | Cleanup config file | ||||||||||
| compile | Compiles the source code | ||||||||||
| compile-tomcat-realm | Compile the Tomcat realm | ||||||||||
| dist-tgz | Packages eXist into a .tgz file | ||||||||||
| dist-war | Packages eXist into a .war file for deployment within a servlet engine | ||||||||||
| dist-zip | Packages eXist into a .zip file | ||||||||||
| docs | Creates a static HTML version of the documentation into docs.zip | ||||||||||
| download-additional-jars | Download optional third-party jar files. These are currently: icu4j and saxon. These are downloaded into lib/user/ | ||||||||||
| download-xqts | Download XQTS file. | ||||||||||
| download-xslts | Download XSLTS file. | ||||||||||
| extensions | Creates the necessary .jar files for eXist's extensions. Read extensions/modules/build.properties to select the extensions to build. | ||||||||||
| installer | Creates a new installer package based on IzPack | ||||||||||
| installer-exe | Create .exe from installer | ||||||||||
| jar | The default: compiles the source and creates eXist's main .jar files | ||||||||||
| javadocs | Creates the API docs into webapp/api | ||||||||||
| javadocs-uml | Creates the API docs along with UML diagrams into webapp/api NoteThis build target takes a long time to run, because it is generating graphics for every package in eXist. |
||||||||||
| jdepend | JDepend traverses Java class file directories and generates design quality metrics for each Java package. | ||||||||||
| jetty-keygen | Generate keystore for jetty. | ||||||||||
| jnlp-clean | |||||||||||
| jnlp-keygen | Generate keystore for signing jars. | ||||||||||
| jnlp-pack200 | Pack all jar files. | ||||||||||
| jnlp-sign-all | This signs all of the jar files, so that the webstart of the eXist client Java application will launch without any signing errors. | ||||||||||
| jnlp-sign-core | Sign all CORE jar files. | ||||||||||
| jnlp-sign-exist | Sign all EXIST jar files. | ||||||||||
| jnlp-unsign-all | This unsigns all of the jar files. | ||||||||||
| pmd | PMD scans Java source code and looks for potential problems like:
|
||||||||||
| rebuild | Performs a clean and the all | ||||||||||
| samples | Builds the examples and packs them into examples.jar | ||||||||||
| snapshot-installer | Creates a snapshot installer | ||||||||||
| svn-diff | Makes a patch file. | ||||||||||
| svn-download | This downloads a jar file that places the current revision number of the working copy of eXist into VERSION.txt. This allows for the tagging of the build with the revision number. | ||||||||||
| svn-update | Update project from SubVersion archive. | ||||||||||
| test | Runs all tests in the test suite and outputs the HTML result into test/junit/html. This may take several minutes. | ||||||||||
| xquery | Regenerate the XQuery parser code with ANTLR (only required if you change src/org/exist/xquery/parser/XQuery.g). |
You might want to set some custom settings (in particular your HTTP proxy when external libraries are required) before running build.sh or build.bat. See build.properties.
Since spring 2006, the entire code base of eXist is managed by the Subversion repository at Sourceforge. Before that we used CVS, which had a few issues, especially due to the separation into a developer's and anonymous server. Using Subversion should be much simpler, faster and more reliable.
Fortunately, you don't need to be a hardcore Java developer to use the SVN version of eXist. In general, we try to keep the development version in a consistent state. The code should always compile and run the test cases, though temporary failures are possible, especially while a larger update is in progress.
The repository root URL is:
Please note you have to use https, not http.
The current development trunk is at:
This is the URL you will normally use for a checkout of the main eXist development tree.
There are many Subversion clients to choose from. If you want to actively contribute to eXist or otherwise work on eXist's source code, we recommend to use eclipse to check out the sources (see below) and setup a project. Otherwise, you can use any other SVN client. On Linux, I prefer the plain command line. For example, the following command checks out the main development trunk into a directory called eXist-trunk:
A good choice on the Windows platform is Tortoise SVN. Tortoise is an extension to the windows shell. The following screenshot shows the checkout dialog:
The repository already contains project configuration files for eclipse, so setting up the project should be pretty simple: you normally don't need to change much in order to dive into the source code (though you may need some customizations to build and run directly from within eclipse).
To access a Subversion repository from within eclipse, you need to install the subclipse plugin first! Please follow the install instructions available there.
Once you installed subclipse, change to the perspective: "SVN Repository Exploring". In the "SVN Repository" tab of the left view, right click into the empty space and select , then . In the appearing dialog, enter the URL of the eXist development trunk:
The URL will now be listed in the "SVN Repository" view. Right click the URL and select . A progress window appears, saying that eclipse is "getting remote info". Once it finished, you should see the following dialog:
Just press unless you want to specify a different directory or checkout a certain tag.
The database can be easily accessed with the Java client, when the client is launched by clicking the Java Webstart "Launch" button on the right side of this page. Java webstart explicilty requires that all application code, the 'jar' files, are signed using a security certificate. Out of the box, when eXist-db is installed using the installer, all relevant jar files have already been signed, so webstart can be used directly. It is nessecary however to (re-)sign the jar files yourself if you want to (re-)build the eXist-db java code. This chapter explains how to do this.
To get started quickly, just execute the following command:
This command sequentially creates the key.store file and signs a selection of jar files:
Note that this command needs to be executed just once. In subsequent builds newly generated jars are signed automatically.
An overview of all available ant targets can be retrieved by executing the following command:
The following ant targets are available for signing jar files:
jnlp-all |
Create keystore file and sign all EXIST and CORE jar files. (Default task) |
|---|---|
jnlp-keygen |
Generate a new keystore file if not present. |
jnlp-clean |
Delete the keystore file. |
jnlp-sign-core |
Sign all CORE jar files in lib/core. |
jnlp-sign-exist |
Sign all EXIST jar files, e.g. exist.jar, exist-XX.jar and start.jar |
jnlp-unsign-all |
Unsign all jar files. |
The target jnlp-keygen generates a new certificate file key.store. If this file is present the EXIST jar files are signed during each following build. The process of signing jar files can be stopped by removing this keystore file.
The ant script contains two additional targets: jetty-keygen which generates a keystore file for the jetty server and jnlp-pack200 which processes the signed jar files with pack200 technology. More about the latter in the next section.
Pack200 is a compression technology introduced in Java 1.5.0. It has been designed for compressing jar files and works most efficiently on Java class files. Pack200 can reduce the size of a jar file up to 60% resulting into a significant reduction of the amount of downloaded webstart data.
The webstart jar files can be compressed with pack200 with the following command:
The pack200 compression feature works with Java SE 6 update 10 (Java6u10) or newer. Older Java6 versions will only receive the larger jar files.