gpt4 book ai didi

mysql - Dropwizard Liquibase,运行 db migrate.xml 文件,该文件位于 jar 内

转载 作者:行者123 更新时间:2023-11-29 11:28:52 25 4
gpt4 key购买 nike

我需要在 Linux 服务器中运行我的 dropwizard jar。jar 内的配置文件。当我在开发中使用maven时,一切正常。我对 liquibase 和 dropwizard 配置文件都有问题。当我将配置放在 jar 之外时,对于 dropwizard

java -jar myapp.jar server config.yml

没关系,应用程序。 strated,但没有执行 liquibase 迁移,我在 pom.xml 中有哪些配置

 <plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<changeLogFile>
${basedir}/src/main/resources/migrations.xml
</changeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/twitterdb</url>
<username>root</username>
<password>root</password>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>

我下载了liquibase,解压,将liquibase home设置为ENV。

现在我尝试运行

java -jar liquibase/liquibase.jar --driver=com.mysql.jdbc.Driver --changeLogFile=migratedb.xml --url="jdbc:mysql://localhost:3306/twitterDB" --username=root --password=root update .

但是在这种情况下liquibase没有找到mysql驱动程序。

基本上我想使用 jar 内的配置文件启动项目。

有什么建议吗?

最佳答案

添加将类路径设置为驱动程序安装目录

--classpath=<value> Classpath containing migration files and JDBC Driver.

关于mysql - Dropwizard Liquibase,运行 db migrate.xml 文件,该文件位于 jar 内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37750547/

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