gpt4 book ai didi

java - 如何使用 Maven 启动/停止 hsqldb?

转载 作者:搜寻专家 更新时间:2023-11-01 01:54:19 24 4
gpt4 key购买 nike

我正在尝试使用 Maven 启动和停止 hsqldb。我想在测试阶段之前启动具有特定配置(数据库)的 hsqldb 服务器,然后停止它,并在应用程序启动之前和之后对其他配置进行相同的操作。

目前我使用 maven exec 插件启动 hsqldb,但问题是服务器启动阻止了完整的 maven 构建过程(点击 CTRL+C 停止服务器。)也没有自动停止服务器的解决方案。

最好的问候

赫默罗克

最佳答案

检查我的 hsqldb maven 插件: https://github.com/avianey/hsqldb-maven-plugin

你可以像 jetty-maven-plugin 或 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>

关于java - 如何使用 Maven 启动/停止 hsqldb?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14521452/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com