我需要在 linux 服务器中运行我的 dropwizard jar。jar 内的配置文件。当我在我的开发中使用 maven 时,一切都很好。我对 liquibase 和 dropwizard 配置文件都有问题。当我把配置放在jar外面时,对于dropwizard
。java -jar myapp.jar server config.yml
没关系,应用程序分层,但不执行 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>
我下载了液基,提取,将液基库主页设置为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.