Mvn liquibase:diff fails to create change log file if not present in 4.17.x

I upgraded liquibase from 4.16.1 to 4.18.0. When I run command

mvn liquibase:diff -Pdev -Dliquibase.url="jdbc:sqlserver://URL;encrypt=false" -Dliquibase.username="db-admin" -Dliquibase.password="PASSWORD" -Dliquibase.referenceUrl="jdbc:sqlserver://URL;encrypt=false" -Dliquibase.referenceUsername="sa" -Dliquibase.referencePassword="PASSWORD"

I get the error

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.18.0:diff (default-cli) on project pres: 
[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.exception.CommandExecutionException: java.io.IOException: Cannot parse resource location: 'src/main/resources/db/changelog/dev/2022-12-17T01:09:39Z_changelog.xml

In 4.16.x or before liquibase creates change log file if not present and now it’s not creating it. Anything changed?

pom.xml

            <!-- Liquibase plugin-->
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase-maven-plugin.version}</version>
                <configuration>
                    <propertyFile>src/main/resources/liquibase.properties</propertyFile>
                    <outputChangeLogFile>src/main/resources/db/db.changelog-${activeProfile}.xml</outputChangeLogFile>
                    <changeLogFile>src/main/resources/db/db.changelog-${activeProfile}.xml</changeLogFile>
                    <diffChangeLogFile>
                        src/main/resources/db/changelog/${activeProfile}/${maven.build.timestamp}_changelog.xml
                    </diffChangeLogFile>
                    <logging>info</logging>
                </configuration>

                <!-- Liquibase dependencies-->
                <dependencies>
                    <dependency>
                        <groupId>org.liquibase</groupId>
                        <artifactId>liquibase-core</artifactId>
                        <version>${liquibase-core.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.liquibase.ext</groupId>
                        <artifactId>liquibase-hibernate5</artifactId>
                        <version>${liquibase-hibernate5.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-data-jpa</artifactId>
                        <version>${spring-boot.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>jakarta.validation</groupId>
                        <artifactId>jakarta.validation-api</artifactId>
                        <version>${validation-api.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.javassist</groupId>
                        <artifactId>javassist</artifactId>
                        <version>${javassist.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>${jaxb-api.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

Hi @JohnDavis . I would report the issue in our github repo to document and possibly have someone fix the issue in the maven plugin.

Maven timestamp by default produces an incompatible file name: 2022-12-17T01:09:39Z

To change this you would have to add to your pom.xml:

<properties>
        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
1 Like