[英]liquibase.exception.ChangeLogParseException: ChangeLogFile does not exists
[英]The changeLogFile must be specified error on Liquibase
我是 Liquibase 的新手,我嘗試將 liquibase 與 postgres 數據庫結合使用,以使用 liquibase 腳本創建數據庫表。 我所做的是,我已經通過運行命令手動創建了 Postgres 表
mvn liquibase:generateChangeLog
我創建了 liquibase-outputChangeLog.xml 文件。 現在我嘗試更新該腳本並在數據庫中再創建一個表。 為此,我在我的 changeLog.xml 文件中為該新表編寫了 XML 代碼,並嘗試執行命令
mvn liquibase:更新
但它給我以下錯誤
必須指定 ChangeLogFile。
下面是我的 POM.xml 文件。
<dependency>
<groupId>tech.sample</groupId>
<artifactId>common-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>tech.sample</groupId>
<artifactId>common-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.8.7</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.8.7</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<!--Sonar Plugins-->
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
他們中的任何一個都可以幫助我,這里有什么問題。
我認為問題在於,在您的 pom.xml <propertyFile>src/main/resources/liquibase.properties</propertyFile>
中指定的屬性文件中,您使用了ChangeLogFile
(大寫 C)而不是changeLogFile
(低案例 C)。 請注意,錯誤消息顯示正確的大小寫。
對於數據庫更新,您必須在插件liquibase-maven-plugin部分的pom.xml中指定屬性changeLogFile 。 見片段:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<configuration>
<propertyFile>src/main/resources/db/liquibase.properties</propertyFile>
<changeLogFile>src/main/resources/db/updateDb.xml</changeLogFile>
</configuration>
</plugin>
在 liquibase 4.7.1上運行
這里是完整的 MVN 日志:
bmolino@Betelgeuse:~/git/simbo-repo/simbo/simbo-ws(master)$ /opt/apache-maven-3.6.3/bin/mvn liquibase:update [INFO] Scanning for projects... [INFO] [INFO] ----------------< it.invallee.webapp.simbo-ws:simbo-ws >---------------- [INFO] Building simbo-ws 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- liquibase-maven-plugin:4.7.1:update (default-cli) @ simbo-ws --- [INFO] ------------------------------------------------------------------------ [project, pluginDescriptor] [INFO] Parsing Liquibase Properties File [INFO] File: src/main/resources/db/liquibase.properties [INFO] 'outputChangeLogFile' in properties file is not being used by this task. [INFO] ------------------------------------------------------------------------ [INFO] [INFO] [INFO] Liquibase Community 4.7.1 by Liquibase [INFO] #################################################### ## _ _ _ _ ## ## | | (_) (_) | ## ## | | _ __ _ _ _ _| |__ __ _ ___ ___ ## ## | | | |/ _` | | | | | '_ \ / _` / __|/ _ \ ## ## | |___| | (_| | |_| | | |_) | (_| \__ \ __/ ## ## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___| ## ## | | ## ## |_| ## ## ## ## Get documentation at docs.liquibase.com ## ## Get certified courses at learn.liquibase.com ## ## Free schema change activity reports at ## ## https://hub.liquibase.com ## ## ## #################################################### Starting Liquibase at 16:05:17 (version 4.7.1 #1239 built at 2022-01-20 20:31+0000) [INFO] Set default schema name to public [INFO] Parsing Liquibase Properties File src/main/resources/db/liquibase.properties for changeLog parameters [INFO] Executing on Database: jdbc:postgresql://XX.XXX.XXX.XXX:5432/simbo [INFO] Successfully acquired change log lock [INFO] Reading from databasechangelog Running Changeset: src/main/resources/db/updateDb.xml::1::bob [INFO] Table department created [INFO] ChangeSet src/main/resources/db/updateDb.xml::1::bob ran successfully in 16ms [INFO] Successfully released change log lock [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.073 s [INFO] Finished at: 2022-01-28T16:05:18+01:00 [INFO] ------------------------------------------------------------------------
您應該移至liquibase版本4.11.0
並將changeLogFile
更改為outputChangeLogFile
希望有幫助
當您在liquibase.properties中更改某些內容時,您應該每次都編譯源代碼。 mvn compile
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.