Skip to content
ljnelson edited this page Feb 6, 2012 · 5 revisions

The h2-maven-plugin project provides a Maven plugin that allows you to spawn an H2 TCP server from Maven. This is useful during unit and integration testing.

You configure this plugin like you would any other Maven plugin. Here's a code snippet that should go in your <build><plugins> stanza to automatically start an H2 TCP server on port 9092 during the pre-integration-test phase, and will stop it during the post-integration-test phase:

<plugin>
  <groupId>com.edugility</groupId>
  <artifactId>h2-maven-plugin</artifactId>
  <version>1.0</version> <!-- or whatever version you like -->
  <executions>
    <execution>
      <id>Spawn a new H2 TCP server</id>
      <goals>
        <goal>spawn</goal>
      </goals>
    </execution>
    <execution>
      <id>Stop a spawned H2 TCP server</id>
      <goals>
        <goal>stop</goal>
      </goals>
    </execution>
  </executions>
</plugin>
Clone this wiki locally