liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
197 stars 57 forks source link

The Changelog file location differs by OS #111

Closed pyaqubzade closed 1 year ago

pyaqubzade commented 1 year ago

I have Gradle multi-project application. The root project doesn't have any sources or resources. Main function is located under app folder (submodule).

rootProjectName
├── app                   # Main function with @SpringBootApplication annotation                    
│   ├── src
│   │   ├── main
│   │   │   ├── java
│   │   │   ├── resources
│   │   │   │   ├── db
│   │   │   │   │   ├── 1.0
│   │   │   │   │   │   ├── changelog-1.0.yml
│   │   │   │   │   │   ├── ...
│   │   │   │   ├── changelog-master.yml
│   app.gradle.kts

Inside my build configuration, I have

configure<LiquibaseExtension> {
    activities.register("main") {
        this.arguments = mapOf(
            "logLevel" to "info",
            "driver" to "org.postgresql.Driver",
            "changeLogFile" to "src/main/resources/db/changelog-master.yml",
            "url" to "${System.getenv()["DB_URL"]}",
            "username" to "${System.getenv()["DB_USER"]}",
            "password" to "${System.getenv()["DB_PASS"]}",
        )
    }
}

When I run gradle app:update command on MacOS it plugin throws this: java.nio.file.NoSuchFileException, if I add change my changelog file location from src/main/resources/db/changelog-master.yml to app/src/main/resources/db/changelog-master.yml it starts working. In contrary on Windows system app/src/main/resources/db/changelog-master.yml doesn't work but when I change path to src/main/resources/db/changelog-master.yml starts working again. Path of changelog file also affects databasechangelog table too. I need to update all my filenames based on OS I am trying to run my application.