简体   繁体   中英

How to start/stop hsqldb using maven?

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM