I am new to Liquibase and i tried to using the liquibase with postgres database to create database tables using liquibase script. What i did is, i already created Postgres tables manually and by running the command
mvn liquibase:generateChangeLog
i created liquibase-outputChangeLog.xml file. 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
mvn liquibase:update
But its giving me below error
The ChangeLogFile must be specified.
Below is my POM.xml file.
<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). 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. 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
Here the complete MVN log:
:$ /opt/apache-maven-3.6.3/bin/mvn liquibase:update [] Scanning for projects... [] [] it.invallee.webapp.simbo-ws:simbo-ws [] [] [] [] liquibase-maven-plugin:4.7.1:update @ simbo-ws [] ------------------------------------------------------------------------ [project, pluginDescriptor] [] Parsing Liquibase Properties File [] File: src/main/resources/db/liquibase.properties [] 'outputChangeLogFile' in properties file is not being used by this task. [] ------------------------------------------------------------------------ [] [] [] Liquibase Community 4.7.1 by Liquibase [] #################################################### ## _ _ _ _ ## ## | | (_) (_) | ## ## | | _ __ _ _ _ _| |__ __ _ ___ ___ ## ## | | | |/ _` | | | | | '_ \ / _` / __|/ _ \ ## ## | |___| | (_| | |_| | | |_) | (_| \__ \ __/ ## ## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___| ## ## | | ## ## |_| ## ## ## ## 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) [] Set default schema name to public [] Parsing Liquibase Properties File src/main/resources/db/liquibase.properties for changeLog parameters [] Executing on Database: jdbc:postgresql://XX.XXX.XXX.XXX:5432/simbo [] Successfully acquired change log lock [] Reading from databasechangelog Running Changeset: src/main/resources/db/updateDb.xml::1::bob [] Table department created [] ChangeSet src/main/resources/db/updateDb.xml::1::bob ran successfully in 16ms [] Successfully released change log lock [] ------------------------------------------------------------------------ [] [] [] [] [] Total time: 2.073 s [] Finished at: 2022-01-28T16:05:18+01:00 []
You should move to liquibase version 4.11.0
and change changeLogFile
to outputChangeLogFile
Hope that's help
When you change something in liquibase.properties , you should compile source code every time. mvn compile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.