我在 Kubuntu 上使用 snap 包管理器安装了 Liquibase CLI。
调用以下命令会导致
liquibase calculateChecksum 2022-01-06-test.sql::1::bobby.tables --changeLogFile 2022-01-06-test.sql
--url jdbc:mysql://localhost:3306 --username root --password password
--driver com.mysql.jdbc.Driver --classpath ~/.m2/repository/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar
导致堆栈跟踪(DEBUG)
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:131)
at liquibase.integration.commandline.Main.doMigration(Main.java:1408)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:361)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.Scope.child(Scope.java:222)
at liquibase.Scope.child(Scope.java:226)
at liquibase.integration.commandline.Main$1.run(Main.java:360)
at liquibase.integration.commandline.Main$1.run(Main.java:193)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:145)
at liquibase.integration.commandline.Main.run(Main.java:193)
at liquibase.integration.commandline.Main.main(Main.java:156)
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:250)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:140)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:96)
... 14 more
Caused by: java.lang.RuntimeException: Cannot find database driver: com.mysql.jdbc.Driver
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:192)
... 16 more
我没有使用 liquibase.properties 文件,因为我只想计算一个 md5 哈希和,所以我可以将它与不同的 md5 值进行比较。
我需要将 mysql.jar 放在 liquibase 二进制文件所在的位置吗?
如果是这样,它作为快照包住在哪里?