Skip to content

Instantly share code, notes, and snippets.

@Ameausoone
Last active October 14, 2019 12:30
Show Gist options
  • Save Ameausoone/4714699 to your computer and use it in GitHub Desktop.
Save Ameausoone/4714699 to your computer and use it in GitHub Desktop.
exec-maven-plugin for start H2 database
<profiles>
<profile>
<id>start-h2</id>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.162</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.h2.tools.Server</mainClass>
<arguments>
<!-- Start also UI -->
<argument>-web</argument>
<!-- db is available via tcp -->
<argument>-tcp</argument>
<!-- local file is present in project-->
<argument>-baseDir</argument>
<argument>${basedir}/${local-h2-directory}</argument>
<!-- Other computers can connect to this db -->
<argument>-webAllowOthers</argument>
<argument>-webPort</argument>
<argument>${h2database.port}</argument>
<!-- uncomment if you want to open h2 UI automatically -->
<!-- <argument>-browser</argument> -->
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
@rohitvvv
Copy link

rohitvvv commented Feb 8, 2016

Thank you for the gist. I tried the above along with
<activeProfiles> redhat-ga-repository <activeProfile>start-h2</activeProfile> </activeProfiles>
Also under profile I have added
<activation> <activeByDefault>true</activeByDefault> </activation>

However the h2 web console does not start. Anything I am missing here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment