Liquibase Maven 无法读取 changeLogFile

     2023-02-26     18

关键词:

【中文标题】Liquibase Maven 无法读取 changeLogFile【英文标题】:Liquibase Maven can't read changeLogFile 【发布时间】:2017-08-10 01:11:45 【问题描述】:

根据我的 File structure 我遇到了错误

liquibase.exception.SetupException:文件:/src/main/liquibase/changes/000-initial-schema.xml 不存在

我的 pom.xml 插件是这样配置的:

<build>
    <plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>3.5.3</version>
            <configuration>
                <propertyFile>src/main/liquibase/liquibase.properties</propertyFile>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我的 liquibase.properties 文件是:

driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/versioned 用户名= 密码= changeLogFile=src/main/liquibase/master.xml

我的master.xml是

<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="src/main/liquibase/changes" />
</databaseChangeLog>

为什么 Liquibase 找不到那个文件?即使我将该文件名更改为: 000-initial-schemaTEST.xml 错误是:

liquibase.exception.SetupException:文件:/src/main/liquibase/changes/000-initial-schemaTEST.xml 不存在

我也放了那个文件(它是由 generateChangeLog 目标从数据库生成的)

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet author="arek (generated)" id="1489753245544-1">
    <createTable tableName="user">
        <column autoIncrement="true" name="id" type="INT">
            <constraints primaryKey="true"/>
        </column>
        <column name="name" type="VARCHAR(255)">
            <constraints nullable="false"/>
        </column>
    </createTable>
</changeSet>
<changeSet author="arek (generated)" id="1489753245544-2">
    <addUniqueConstraint columnNames="id" constraintName="id_UNIQUE" tableName="user"/>
</changeSet>

对比master.xml文件为:

<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">

<include file="src/main/liquibase/changes/001-add-user-address.xml" />
<!--<includeAll path="src/main/liquibase/changes" />-->
</databaseChangeLog>

有效

【问题讨论】:

【参考方案1】:

在我的情况下,解决方案是为每个“包含”标签添加到 db-changelog-master.xml,声明:relativeToChangelogFile="true",如下所示:

<include file="e6ebb/ddl/61-someChanges.xml" relativeToChangelogFile="true"/>

【讨论】:

【参考方案2】:

解决办法是更新ma​​ster.xml

<includeAll path="changes" relativeToChangelogFile="false" />

【讨论】:

【参考方案3】:

liquibase 找到要包含的文件,但未正确加载它们。

在本例中,liquibase 在列出文件夹内容时会找到文件 include.xml,但无法加载它。

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default-cli) on project testLiquibase: Error setting up or running Liquibase: liquibase.exception.SetupException: file:/src/main/resources/include/include.xml does not exist -> [Help 1]

此问题跟踪:https://liquibase.jira.com/browse/CORE-2980

【讨论】:

【参考方案4】:

原因是 maven Liquibase 版本。

该错误仅在版本中发生:

3.5.3 3.5.2

在 3.5.1 及以下版本中有效。

也许有人知道为什么它在 3.5.2 和 3.5.3 中不起作用,以及在这些版本中应该如何配置?

【讨论】:

还有版本 3.6.2。 和版本 3.6.3

Liquibase maven插件不起作用

】Liquibasemaven插件不起作用【英文标题】:Liquibasemavenpluginnotworking【发布时间】:2017-08-1500:52:33【问题描述】:我正在为Oracle12c数据库使用Liquibasemaven插件,运行更新命令时出现以下错误:无法在项目liquibase上执行目标org.liquibase:... 查看详情

从 databasechangelog 读取 Liquibase 需要很长时间

】从databasechangelog读取Liquibase需要很长时间【英文标题】:Liquibasereadingfromdatabasechangelogtakesalongtime【发布时间】:2012-06-1312:14:00【问题描述】:有没有什么方法可以加快liquibase回滚和更新操作的maven任务?我现在在数据库中有大... 查看详情

为啥 liquibase 无法解析 db.changelog 类路径?

】为啥liquibase无法解析db.changelog类路径?【英文标题】:Whyliquibaseunabletoresolvedthedb.changelogclasspath?为什么liquibase无法解析db.changelog类路径?【发布时间】:2018-03-3008:37:19【问题描述】:这是maven依赖jar项目之一的结构,其中一个... 查看详情

无法初始化类 liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator

】无法初始化类liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator【英文标题】:Couldnotinitializeclassliquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator【发布时间】:2014-10-2202:11:12【问题描述】:当我尝试运行maven测试时遇到此问题。不确定... 查看详情

liquibase-maven-plugin 和 sqlFile

】liquibase-maven-plugin和sqlFile【英文标题】:liquibase-maven-pluginandsqlFile【发布时间】:2016-09-2305:53:45【问题描述】:我正在尝试使用liquibase-maven-plugin来运行我的数据库更新。我有以下插件配置:<configuration><username>$dba.usernam... 查看详情

liquibase-maven-plugin 与 testcontainers 的使用

】liquibase-maven-plugin与testcontainers的使用【英文标题】:Theusageofliquibase-maven-pluginwithtestcontainers【发布时间】:2021-12-0100:44:29【问题描述】:假设我有这个插件配置(使用hsqldb):<plugin><groupId>org.liquibase</groupId><artif... 查看详情

Liquibase 和 JPA 注释实体

】Liquibase和JPA注释实体【英文标题】:LiquibaseandJPAannotatedentities【发布时间】:2015-01-1014:17:03【问题描述】:我正在尝试将Liquibase与JPA注释一起使用,但我似乎无法正常工作。我的项目中有一个没有表和一个JPA实体的干净数据库... 查看详情

通过 maven liquibase 插件填充时,Hsqldb 没有数据

】通过mavenliquibase插件填充时,Hsqldb没有数据【英文标题】:Hsqldbhasnodatawhenpopulatedviamavenliquibaseplugin【发布时间】:2013-04-2403:25:32【问题描述】:我已创建架构并通过Mavenliquibase插件填充它:<plugin><groupId>org.liquibase</gro... 查看详情

如何在 Spring Boot 中配置 Maven Liquibase 插件?

】如何在SpringBoot中配置MavenLiquibase插件?【英文标题】:HowcanIconfigureMavenLiquibaseplugininSpringBoot?【发布时间】:2019-08-3023:35:24【问题描述】:我正在学习Liquibase和SpringBoot,所以我用SpringInitializr创建了一个简单的项目。在我添加的... 查看详情

Liquibase 看不到实体的变化

】Liquibase看不到实体的变化【英文标题】:Liquibasedonotseechangesinentities【发布时间】:2015-01-2309:16:05【问题描述】:我正在尝试使用liquibase配置简单的maven项目。我有很多关于liquibase-maven-plugin和liquibase-hibernate4版本的问题,它们不... 查看详情

Liquibase maven:spring-boot启动时找不到更改日志位置

】Liquibasemaven:spring-boot启动时找不到更改日志位置【英文标题】:Liquibasemaven:Cannotfindchangeloglocationwhenspring-bootstarts【发布时间】:2018-12-1416:38:01【问题描述】:我的liquibasemaven插件配置是:<plugin><groupId>org.liquibase</grou... 查看详情

Selenium - Maven 依赖项 - 无法读取工件描述符

】Selenium-Maven依赖项-无法读取工件描述符【英文标题】:Selenium-MavenDependency-Failedtoreadartifactdescriptor【发布时间】:2019-08-1015:00:25【问题描述】:我是Maven新手,并且是一般的编程新手。我所做的只是创建了这个项目并在pom.xml文... 查看详情

无法与 liquibase gradle 插件生成差异

】无法与liquibasegradle插件生成差异【英文标题】:Unabletogeneratedifferencefromliquibasegradleplugin【发布时间】:2016-06-1311:38:56【问题描述】:我正在尝试使用MYSQL数据库在现有SpringBoot项目中实现liquibase。我希望能够生成更改集,指定实... 查看详情

chan中可以阻止多少写操作

...2-0118:41:26【问题描述】:我使用chan用于goroutines进行写入/读取,如果chan已满,写入goroutines将被阻塞,直到另一个goroutine从chan读取。我知道chan中有一个recvq和sendq双链表来记录被阻塞的goroutine。我的问题是,如果不读 查看详情

Proguard 混淆在使用 Maven 的 Jenkins 构建中失败 - 无法读取 classes.jar

】Proguard混淆在使用Maven的Jenkins构建中失败-无法读取classes.jar【英文标题】:ProguardObfuscationfailedinJenkinsbuildusingMaven-can\'treadclasses.jar【发布时间】:2012-08-1800:02:02【问题描述】:我正在使用Jenkins在Linux机器上构建一个Maven项目并收... 查看详情

idea中maven项目xml资源文件无法读取

解决方法:编辑pom.xml文件添加如下标签<build><resources><resource><directory>src/main/java</directory><includes><include>**/*.xml</include></includes></resourc 查看详情

无法使用 Liquibase 中的序列在表中插入值

】无法使用Liquibase中的序列在表中插入值【英文标题】:UnabletoinsertvaluesinatableusingsequenceinLiquibase【发布时间】:2015-11-3023:50:12【问题描述】:我想使用sequence_name.NEXTVAL在liquibase中自动计算列的值。后端数据库是postgresql。我尝试... 查看详情

无法让 liquibase-hibernate 插件与 gradle 一起工作

】无法让liquibase-hibernate插件与gradle一起工作【英文标题】:Unabletogetliquibase-hibernatepluginworkwithgradle【发布时间】:2018-08-1913:38:13【问题描述】:在尝试将liquibase:hibernate插件与spring-boot:gradle:postgres集成时,我在运行gradlediff命令时... 查看详情