在 Java 应用程序中使用 Liquibase 迁移时出现许可证错误

Licence error while using Liquibase Migrations in Java Application

我有 java 使用 Dropwizard 框架创建的应用程序,我在其中使用了 liquibase 迁移。我可以从 eclipse 运行 "db migrate" 命令,但终端 cli 的相同命令失败。

长期以来,我一直试图找出我的设置中的错误,但现在我需要 liquibase 专家的帮助。这是打印的错误日志。请让我知道 - 可能有什么问题。

OS : MAC OS X
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

java -jar target/code.jar db migrate src/main/resources/code-local.yml                                    
INFO  [2015-09-07 11:36:00,288] liquibase: Successfully acquired change log lock
INFO  [2015-09-07 11:36:07,866] liquibase: Successfully released change log lock
Exception in thread "main" liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: /var/folders/7y/3wfpy71x4j779d854h_g_h48zrgjtv/T/liquibase-unzip3153640369191170689.dir/license/LICENSE (Not a directory)
    at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27)
    at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:215)
    at liquibase.Liquibase.update(Liquibase.java:192)
    at liquibase.Liquibase.update(Liquibase.java:181)
    at liquibase.Liquibase.update(Liquibase.java:174)
    at io.dropwizard.migrations.DbMigrateCommand.run(DbMigrateCommand.java:57)
    at io.dropwizard.migrations.DbCommand.run(DbCommand.java:52)
    at io.dropwizard.migrations.AbstractLiquibaseCommand.run(AbstractLiquibaseCommand.java:63)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
    at io.dropwizard.cli.Cli.run(Cli.java:70)
    at io.dropwizard.Application.run(Application.java:73)
    at com.x.y.MainApplication.main(MainApplication.java:39)
Caused by: liquibase.exception.SetupException: /var/folders/7y/3wfpy71x4j779d854h_g_h48zrgjtv/T/liquibaseunzip3153640369191170689.dir/license/LICENSE (Not a directory)
    at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:334)
    at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:264)
    at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:211)
    at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25)
    ... 11 more
Caused by: java.io.FileNotFoundException: /var/folders/7y/3wfpy71x4j779d854h_g_h48zrgjtv/T/liquibase-unzip3153640369191170689.dir/license/LICENSE (Not a directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at liquibase.util.FileUtil.unzip(FileUtil.java:76)
    at liquibase.resource.ClassLoaderResourceAccessor.list(ClassLoaderResourceAccessor.java:82)
    at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:316)
    ... 14 more

您是否也尝试将 Liquibase 库文件夹添加到 class 路径?

java -jar liquibase.jar;lib/snakeyaml-1.13.jar;target/code.jar db migrate src/main/resources/code-local.yml

我已经提到了 liquibase 3.4.1 版本的 jar 文件名。根据您的设置进行更改。