Rollback script isn't generated by maven plugin in case of liquibase initialized DB by Spring

Hello Everyone,

I have an application built on top of Spring Boot + Liquibase, where Liquibase configured the following way:

public class LiquibaseConf {

  public SpringLiquibase liquibase(DataSource ds) {
    SpringLiquibase springLiquibase = new SpringLiquibase();
    return springLiquibase;

Recently, I decided to build CI pipeline with possibility to rollback to the previous app version which may require rollback of DB changes.
Rollback of DB changes I was going to do via liquibase-maven-plugin i.e. use the following command:
mvn liquibase:rollbackSQL -Dliquibase.rollbackTag=<release_version> where<release_version> is previous release…

Sample of pom.xml file:


The issue that I faced right now is that when DB is initialized by Liquibase via Spring Boot values of filename column in databasechangelog table have classpath: prefix which causes issues when I try to generate rollback script via liquibase maven plugin, as it looks like it expects absolute path to the file names, i.e. c:\app\src\main\resources\db\v02\temp.xml instead of classpath:db/v02/temp.xml.

In my case result is aways the same, plugin generates:

-- Lock Database
UPDATE databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = 'PC (', LOCKGRANTED = '2023-02-22 16:05:35.847' WHERE ID = 1 AND LOCKED = FALSE;

-- Release Database Lock

Just for testing purposes, I also tried to initialize DB via mvn liquibase:update command and only after that was able to generate rollback script, but it’s not what I want.

I would like to continue using Spring Boot + Liquibase to manage DB schema and rollback DB changes via maven plugin. Please suggest me a solution to overcome this issue.


Ok, it looks like I found a workaround for the issue - update Liquibase to the latest version from 3.6.3 that I was using… Not sure why, but after upgrade Liquibase no longer adds classpath: prefix and after specifying in plugin relative path to the changelog file to match to what in the DB, I was finally able to generate rollback script.