【问题标题】:Liquibase migration fails with dropwizard使用 dropwizard 的 Liquibase 迁移失败
【发布时间】:2015-12-19 09:19:29
【问题描述】:

如果我将所有变更集放在一个文件中,它可以正常工作,但如果我这样做:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

  <includeAll path="migrations" />
</databaseChangeLog>

然后我得到下面的错误。迁移目录位于 src/main/resources - 有什么想法我哪里出错了吗?谢谢。

Exception in thread "main" liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: /var/folders/m_/jvmrmqx90n54v276_xvtgxcw0000gn/T/liquibase-unzip5492890813073634394.dir/license/LICENSE.dom-documentation.txt (Not a directory)
    at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27)
    at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:225)
    at liquibase.Liquibase.update(Liquibase.java:200)
    at liquibase.Liquibase.update(Liquibase.java:190)
    at liquibase.Liquibase.update(Liquibase.java:186)
    at liquibase.Liquibase.update(Liquibase.java:179)
    at io.dropwizard.migrations.DbMigrateCommand.run(DbMigrateCommand.java:68)
    at io.dropwizard.migrations.DbCommand.run(DbCommand.java:52)
    at io.dropwizard.migrations.AbstractLiquibaseCommand.run(AbstractLiquibaseCommand.java:61)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:77)
    at io.dropwizard.cli.Cli.run(Cli.java:70)
    at io.dropwizard.Application.run(Application.java:80)
    at uk.co.wansdykehouse.pr.PRApplication.main(PRApplication.java:58)
Caused by: liquibase.exception.SetupException: /var/folders/m_/jvmrmqx90n54v276_xvtgxcw0000gn/T/liquibase-unzip5492890813073634394.dir/license/LICENSE.dom-documentation.txt (Not a directory)
    at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:367)
    at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:274)
    at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:221)
    at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25)
    ... 12 more
Caused by: java.io.FileNotFoundException: /var/folders/m_/jvmrmqx90n54v276_xvtgxcw0000gn/T/liquibase-unzip5492890813073634394.dir/license/LICENSE.dom-documentation.txt (Not a directory)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at liquibase.util.FileUtil.unzip(FileUtil.java:76)
    at liquibase.resource.ClassLoaderResourceAccessor.list(ClassLoaderResourceAccessor.java:87)
    at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:344)
    ... 15 more

编辑:

奇怪的是,这行得通:

<include file="migrations/00001_initial.xml" />

【问题讨论】:

  • 也许你也应该添加你的目录结构。 includeAll 只是尝试识别路径,列出其中的所有文件,然后对所有文件使用include 方法。另外,您可以尝试添加relativeToChangelogFile 选项。
  • 您可以调试到 ClassLoaderResourceAccessor 以查看它正在尝试做什么。资源/迁移中的类路径上还有其他内容吗?

标签: java database liquibase dropwizard


【解决方案1】:

我可能会迟到回答这个问题..但我知道这里出了什么问题。您在“迁移”之后错过了“/”。看这里参考Include all files

【讨论】:

    猜你喜欢
    • 2018-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-16
    • 1970-01-01
    • 2022-06-27
    • 1970-01-01
    • 2017-09-29
    相关资源
    最近更新 更多