MAVEN.md 1.3 KB
Newer Older
1
# H2
2

3
Welcome to H2, the Java SQL database. The main features of H2 are:
4

5 6 7 8 9
* Very fast, open source, JDBC API
* Embedded and server modes; in-memory databases
* Browser based Console application
* Small footprint: around 1.5 MB jar file size

10
## Experimental Building & Testing with Maven
11

12
### Setup JDK
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

Maven requires at minimum the JDK 1.7 whereas H2 is designed to be compiled against the JDK 1.6; the way in which this is
resolved is through [maven toolchains](https://maven.apache.org/guides/mini/guide-using-toolchains.html).

You simply need to create a `toolchains.xml` file in `~/.m2/` that tells maven where to find the JDK 1.6

Here is a sample file

```
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
  <!-- JDK toolchains -->
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.6</version>
    </provides>
    <configuration>
      <jdkHome>/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/</jdkHome>
    </configuration>
  </toolchain>
</toolchains>
```

37
### Building
38 39 40

H2 uses [Maven Wrapper](https://github.com/takari/maven-wrapper) setup, you can instruct users to run wrapper scripts:

41
> $ ./mvnw clean test
42 43 44

or

45 46
> $ ./mvnw.cmd clean test

47
### Running
48 49 50 51 52 53

You can run the server like this

```
mvn exec:java -Dexec.mainClass=org.h2.tools.Server  
```