# Build

Portability
Environment
Building the Software
Build Targets
Using Maven 2
Translating
Providing Patches

## Portability

This database is written in Java and therefore works on many platforms. It can also be compiled to a native executable using GCJ.

## Environment

A Java Runtime Environment (JRE) version 1.4 or higher is required to run this database.

To build the database executables, the following software stack was used. Newer version or compatible software works too.

- Windows XP
- Sun JDK Version 1.4 and 1.6
- Eclipse Version 3.3
- Eclipse Plugins: Subclipse 1.2.4, EclEmma Java Code Coverage 1.3.0, Eclipse Checkstyle Plug-in 4.4.0
- Mozilla Firefox 3.0
- OpenOffice 3.0
- NSIS 2.38 (Nullsoft Scriptable Install System)
- Maven 2.0.7
- YourKit Java Profiler

## Building the Software

On the command line, go to the directory h2 and execute the following command:

    build -?

For Linux and OS X, use `./build.sh` instead of `build`.

You will get a list of targets. If you want to build the jar file, execute (Windows):

    build jar

## Build Targets

The build system can generate smaller jar files as well. The following targets are currently supported:

- jarClient: Create the h2client.jar. This only contains the remote JDBC implementation.
- jarSmall: Create the file h2small.jar. This only contains the embedded database. Debug information is disabled.
- jarJaqu: Create the file h2jaqu.jar. This only contains the JaQu (Java Query) implementation. All other jar files do not include JaQu.

To create the h2client.jar file, go to the directory h2 and execute the following command:

    build jarClient

## Using Maven 2

### Using a Central Repository

You can include the database in your Maven 2 project as a dependency. Example:

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>${version}</version>
    </dependency>

New versions of this database are first uploaded to http://hsql.sourceforge.net/m2-repo/ and then automatically synchronized with the main maven repository; however after a new release it may take a few hours before they are available there.

### Using Snapshot Version

To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command:

    build mavenInstallLocal

Afterwards, you can include the database in your Maven 2 project as a dependency:

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

## Translating

The translation of this software is split into the following parts:

- H2 Console: src/main/org/h2/server/web/res/_text_*.properties
- Error messages: src/main/org/h2/res/_messages_*.properties
- Web site: src/docsrc/text/_docs_*.utf8.txt

The conversion between UTF-8 and Java encoding (using the \u syntax), as well as the HTML entities (&#..;) is automated by running the tool PropertiesToUTF8. The web site translation is automated as well, using `build docs`.

## Providing Patches

If you like to provide patches, please consider the following guidelines to simplify merging them:

- Only use Java 1.4 features (not use Java 1.5 or 1.6) (see Environment).
- Follow the coding style used in the project, use Checkstyle (see above) to check the coding style.
- Please provide test cases and integrate them into the test suite. For Java level tests, see src/test/org/h2/test/TestAll.java. For SQL level tests, see src/test/org/h2/test/test.in.txt or testSimple.in.txt
- The test cases should cover at least 90% of the changed/new code; use a code coverage tool to verify that (see above).
- Verify that you did not break other features: Run the test cases by executing build test.
- Provide end user documentation if required (src/docsrc/html/*).
- Document grammar changes in src/main/org/h2/res/help.csv
- Provide a change log entry (src/docsrc/html/changelog.html).
- Submit patches as .patch files (compressed if big). To create a patch, use for example Eclipse Team/Create Patch.