[英]The changeLogFile must be specified error on Liquibase
I am new to Liquibase and i tried to using the liquibase with postgres database to create database tables using liquibase script.我是 Liquibase 的新手,我尝试将 liquibase 与 postgres 数据库结合使用,以使用 liquibase 脚本创建数据库表。 What i did is, i already created Postgres tables manually and by running the command
我所做的是,我已经通过运行命令手动创建了 Postgres 表
mvn liquibase:generateChangeLog mvn liquibase:generateChangeLog
i created liquibase-outputChangeLog.xml file.我创建了 liquibase-outputChangeLog.xml 文件。 Now i try to update that script and create one more table in the database.
现在我尝试更新该脚本并在数据库中再创建一个表。 For that i write the XML code in my changeLog.xml file for that new table and try to execute the command
为此,我在我的 changeLog.xml 文件中为该新表编写了 XML 代码,并尝试执行命令
mvn liquibase:update mvn liquibase:更新
But its giving me below error但它给我以下错误
The ChangeLogFile must be specified.必须指定 ChangeLogFile。
Below is my POM.xml file.下面是我的 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>
Could any one of them please help me, whats wrong here.他们中的任何一个都可以帮助我,这里有什么问题。
I think the issue is that in your property file as specified in your pom.xml <propertyFile>src/main/resources/liquibase.properties</propertyFile>
you have used ChangeLogFile
(with a capital C) rather than changeLogFile
(with a lower case C).我认为问题在于,在您的 pom.xml
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
中指定的属性文件中,您使用了ChangeLogFile
(大写 C)而不是changeLogFile
(低案例 C)。 Note the error message shows the correct casing.请注意,错误消息显示正确的大小写。
For db updates you must specify the property changeLogFile in your pom.xml , in the plugin liquibase-maven-plugin section.对于数据库更新,您必须在插件liquibase-maven-plugin部分的pom.xml中指定属性changeLogFile 。 See the snippet:
见片段:
<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>
Ran on liquibase 4.7.1在 liquibase 4.7.1上运行
Here the complete MVN log:这里是完整的 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]
------------------------------------------------------------------------
You should move to liquibase version 4.11.0您应该移至liquibase版本4.11.0
and change changeLogFile
to outputChangeLogFile
并将
changeLogFile
更改为outputChangeLogFile
Hope that's help希望有帮助
When you change something in liquibase.properties , you should compile source code every time.当您在liquibase.properties中更改某些内容时,您应该每次都编译源代码。
mvn compile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.