Search code examples
javatravis-ci

Problems with the build in Travis CI in the file search master.xml via Liquibase


Please tell me. My project is built locally with no problems. But Travis CI gets an error in the build:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.2.2:update (default) on project: 

[ERROR] Error setting up or running Liquibase:
[ERROR] The file /home/travis/build/.../src/db/master.xml was not found in
[ERROR]     - /home/travis/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar...

also even lower: [ERROR] - /home/travis/build//target/test-classes

[ERROR] Specifying files by absolute path was removed in Liquibase 4.0. Please use a relative path or add '/' to the classpath parameter.

I had a similar error locally, but for a different file, master.xml where the path to <include file="src/db/scripts/update_001.sql"/> is written - I fixed it, so the project is being built locally. But in Travis, it looks like a similar error, but for the file, master.xml.

Settings in the file pom.xml:

<plugin>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-maven-plugin</artifactId>
    <version>4.2.2</version>
    <configuration>
        <changeLogFile>${basedir}/src/db/master.xml</changeLogFile>
        <url>${db.url}</url>
        <driver>${db.driver}</driver>
        <username>${db.username}</username>
        <password>${db.password}</password>
    </configuration>
    <executions>
        <execution>
            <phase>process-resources</phase>
            <goals>
                <goal>update</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The path is spelled out correctly:

<changeLogFile>${basedir}/src/db/master.xml</changeLogFile>

Solution

  • have you checked out this article? https://docs.liquibase.com/concepts/basic/liquibase-relative-path-best-practices.html

    It seems Liquibase 4.0 and later versions doesn’t allow specifying absolute paths. Instead, use paths relative directories included in your classpath.