gpt4 book ai didi

java - Liquibase Maven 无法读取 changeLogFile

转载 作者:数据小太阳 更新时间:2023-10-29 01:55:52 25 4
gpt4 key购买 nike

据我所知 File structure我遇到了一个错误

liquibase.exception.SetupException: file:/src/main/liquibase/changes/000-initial-schema.xml does not exist

我的 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
username=
password=
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: file:/src/main/liquibase/changes/000-initial-schemaTEST.xml does not exist

我也放了那个文件(它是由 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>

有效

最佳答案

解决方法是更新ma​​ster.xml:

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

关于java - Liquibase Maven 无法读取 changeLogFile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42875117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com