Reputation: 83
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.
Upvotes: 5
Views: 11497
Reputation: 161
When you change something in liquibase.properties, you should compile source code every time. mvn compile
Upvotes: 1
Reputation: 597
You should move to liquibase version 4.11.0
and change changeLogFile
to outputChangeLogFile
Hope that's help
Upvotes: 4
Reputation: 11
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:
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] ------------------------------------------------------------------------
Upvotes: 0
Reputation: 9016
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.
Upvotes: 2