3.5.3: includeAll from the command line uses the absolute path as the changeSet path
Description
Environment
Command line and other uses of FileSystemResourceAccessor
Activity

Vipin Sharma September 10, 2021 at 6:11 PM
I came to this page after checking https://stackoverflow.com/questions/42875117/liquibase-maven-cant-read-changelogfile , getting this in 3.4.1, 3.5.2 and 4.4.3 versions. Surprisingly it works on my windows machine, getting this on wsl2 ubuntu only. is there any workaround available for this?

Steve Saliman June 24, 2018 at 1:46 AMEdited
I'm updating the Liquibase Groovy DSL to work with version 3.6.1, and I'm running into this problem as well. I think the cause of the problem is in AbstractResourceAccessor's getContents method, which is explicitly using file.getAbsolutePath() at line 90.
I'm thinking that file.path() might be a better bet. I can't think of any good reason to use absolute paths in a Liquibase change, because it prevents multiple developers from running Liquibase from their own directories.
This change would help resolve 4 different issues in Jira.

Vincent Deygas January 17, 2017 at 10:29 PM
Reopen https://liquibase.jira.com/browse/CORE-2761
The issue is still present in 3.5.3
If using includeAll, liquibase tries to run the same patch twice (once with the full path and another time with the relative path)
Might be due to the filesystempath being used
DEBUG 1/17/17 10:15 PM: liquibase: Using file opener for includeAll: liquibase.resource.CompositeResourceAccessor(liquibase.resource.FileSystemResourceAccessor(/path/database/.),liquibase.integration.commandline.CommandLineResourceAccessor(file:/usr/share/java/mysql.jar,file:/path/database/))
(No improvement if I try to use --includeSystemClasspath=false)
Command line:
/usr/bin/liquibase --logLevel='debug' --contexts='test' --username='user' --password='password' --url=jdbc:mysql://127.0.0.1/db --driver=com.mysql.jdbc.Driver --includeSystemClasspath=false --classpath=/usr/share/java/mysql.jar:/path/database --changeLogFile='databaseChangeLog.xml' update
databaseChangeLog.xml:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<includeAll relativeToChangelogFile="true" path="patches"/>
</databaseChangeLog>
Using a changelog with something like: <includeAll path="com/example/seq"/> should track and store files as com/example/seq/seq1.xml and com/example/seq/seq2.xml but with 3.5.0 started trackign them as c:\path\to\com\example\seq\seq1.xml.
This caused them to re-execute because liquibase saw the path as different.