Liquibase Maven 无法读取 changeLogFile
根据我的文件结构,我得到了一个错误
liquibase.exception.SetupException: file:/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
username=
password=
changeLogFile=src/main/liquibase/master.xml
我的主人.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 不存在
我也把那个文件(它是通过生成ChangeLog目标从数据库生成的)
<?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>
要比较主文件.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>
它的工作原理