How to start/stop hsqldb using maven?

hsqldb, java, maven

Solution

check my hsqldb maven plugin : https://github.com/avianey/hsqldb-maven-plugin

You can just start/stop it like jetty-maven-plugin or tomee-maven-plugin :

<plugin>

    <!-- current version -->
    <groupId>fr.avianey.mojo</groupId>
    <artifactId>hsqldb-maven-plugin</artifactId>
    <version>1.0.0</version>

    <!-- 
        default value for in memory jdbc:hsqldb:hsql://localhost/xdb
        override only values you want to change
    -->
    <configuration>
        <driver>org.hsqldb.jdbcDriver</driver>
        <path>mem:test</path>
        <address>localhost</address>
        <name>xdb</name>
        <username>sa</username>
        <password></password>
        <validationQuery>SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS</validationQuery>
    </configuration>

    <!-- call start and stop -->
    <executions>
        <execution>
            <id>start-hsqldb</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
        <execution>
            <id>stop-hsqldb</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>

</plugin>

Problem

I'm trying to start and stop hsqldb using maven. I want to start hsqldb server with a specific configuration (database) before the test phase and stop it afterwards and doo the same with an other configuration before and after application starts. At the moment I start hsqldb with the maven exec plugin but the problem is that the server startup is blocking the complete maven build process (Hit CTRL+C to stop the server.) Also there is no solution for stopping the server automatically. Best regards Hemeroc

Original source

Related problems