Search code examples
javaliquibase

How can I get rid of the 'no changelog could be found' error related to Liquibase without using Liquibase?


I'm working with the project, where I have as a POM file:

<dependencies>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
    </dependency>

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-validation</artifactId>
        <version>2.3.2.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.liquibase/liquibase-core -->
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <version>4.16.1</version>
    </dependency>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.4.4</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jooq</artifactId>
        <version>2.7.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.5</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>jakarta.servlet.jsp.jstl</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.20</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jooq/jooq -->
    <dependency>
        <groupId>org.jooq</groupId>
        <artifactId>jooq</artifactId>
        <version>3.15.0</version>
    </dependency>
</dependencies>

While I'm running the current version of the project, I'm getting constantly the issue as:

Liquibase failed to start because no changelog could be found at 'classpath:/db/changelog/db.changelog-master.yaml'.

I've already researched answers based on:

  1. https://stackoverflow.com/a/63227085/8370915
  2. Liquibase failed to start because no changelog could be found at 'Migration File: class path
  3. Why liquibase unable to resolved the db.changelog classpath?

and my question based on it is:

if I don't have any requirements in the task to use Liquibase as an additional tool, can I fix this issue somehow and avoid it as I don't need it.

If yes, do you know what can be the cause of reproducing it? What do I need to change in my POM specifically to remove this error?

I'm asking it, because if I remove the dependency as liquibase-core:

<dependency>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-core</artifactId>
  <version>4.16.1</version>
</dependency>

I'm getting another issue as:

Caused by: java.lang.ClassNotFoundException: liquibase.exception.ChangeLogParseException

and to solve it, I need to add dependency of Liquibase.

I can provide any additional details, if you need.

Thank you in advance for any smart ideas.


Solution

  • As one of the use cases, it can be added the changelog file:

    db.changelog-master.yaml
    

    inside the directory resource/db/changelog/ with the following content as:

    databaseChangeLog:
      - changeSet:
          id: 1
          author: invzbl3
    
    name: db.changelog-master.yaml
    environment: testing
    is-enabled: false
    

    using is-enabled with the value as false.