In my SpringBoot application, I run the following Liquibase commands:
liquibase.update(new Contexts(this.getContexts()), new LabelExpression(this.getLabelFilter()));
liquibase.rollback(1, contexts);
The update works perfectly, finding the changelog and applying the changes as expected. However, the rollback fails with the following error:
Optional[liquibase.exception.ChangeLogParseException: classpath:/changelog/changelog.yaml does not exist]
I noticed that DatabaseChangelogCommandStep.getDatabaseChangeLog
uses:
ResourceAccessor resourceAccessor = Scope.getCurrentScope().getResourceAccessor();
During the update, it returns a SpringResourceAccessor
, but during the rollback, it returns a ClassLoaderResourceAccessor
, which seems to be causing the issue.
Any ideas on why this happens and how to resolve it?