Liquibase Maven can't read changeLogFile

10,126

Solution 1

The reason of that was maven Liquibase version.

That error happens only in versions:

  • 3.5.3
  • 3.5.2

In 3.5.1 and below it works.

Maybe someone knows why it not works in 3.5.2 and 3.5.3 and how it should be configured in these versions ?

Solution 2

Solution is to update master.xml:

<includeAll path="changes" relativeToChangelogFile="false" />

Solution 3

liquibase find the files to include but do not load them correctly.

In this example, liquibase find the file include.xml when listing the content of your folder but don't manage to load it.

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default-cli) on project testLiquibase: Error setting up or running Liquibase: liquibase.exception.SetupException: file:/src/main/resources/include/include.xml does not exist -> [Help 1]

This issue is track: https://liquibase.jira.com/browse/CORE-2980

Share:
10,126
Ferdezo
Author by

Ferdezo

Updated on June 05, 2022

Comments

  • Ferdezo
    Ferdezo almost 2 years

    According to my File structure I got an error

    liquibase.exception.SetupException: file:/src/main/liquibase/changes/000-initial-schema.xml does not exist

    My pom.xml plugin is configured like this:

    <build>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>3.5.3</version>
                <configuration>
                    <propertyFile>src/main/liquibase/liquibase.properties</propertyFile>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>update</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    My liquibase.properties files are:

    driver=com.mysql.jdbc.Driver
    url=jdbc:mysql://localhost:3306/versioned
    username=
    password=
    changeLogFile=src/main/liquibase/master.xml

    My master.xml is

    <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-2.0.xsd">
    <includeAll path="src/main/liquibase/changes" />
    </databaseChangeLog>
    

    Why Liquibase can't find that file ? Even if i change that file name to: 000-initial-schemaTEST.xml the error is:

    liquibase.exception.SetupException: file:/src/main/liquibase/changes/000-initial-schemaTEST.xml does not exist

    I'm putting also that file (it was generated from database by generateChangeLog goal)

    <?xml version="1.1" encoding="UTF-8" standalone="no"?>
    <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
    <changeSet author="arek (generated)" id="1489753245544-1">
        <createTable tableName="user">
            <column autoIncrement="true" name="id" type="INT">
                <constraints primaryKey="true"/>
            </column>
            <column name="name" type="VARCHAR(255)">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>
    <changeSet author="arek (generated)" id="1489753245544-2">
        <addUniqueConstraint columnNames="id" constraintName="id_UNIQUE" tableName="user"/>
    </changeSet>
    

    To comparation when master.xml file is:

    <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-2.0.xsd">
    
    <include file="src/main/liquibase/changes/001-add-user-address.xml" />
    <!--<includeAll path="src/main/liquibase/changes" />-->
    </databaseChangeLog>
    

    It works

  • Wilder Valera
    Wilder Valera over 5 years
    And version 3.6.2.
  • Asaph
    Asaph about 5 years
    And version 3.6.3