I have two modules (editor
and engine
) that work with a common database. For deployment of scripts I want to use liquibase
. I do not want to duplicate the same scripts in two places, and I want to manage them in one place. To do this, I created a separate module (database-structure
) that only contains my scripts and the parameter spring .liquibase.change-log=classpath:db/changelog/db.changelog-master.xml
. I have add this module (database-structure
) as a dependency to my other modules. The final structure is as follows (classes are omitted for compactness):
D:\PROJECTS\MY-PROJECT
├───database-structure
│ │ pom.xml
│ │
│ └───src
│ ├───main
│ │ ├───java
│ │ └───resources
│ │ │ application.properties
│ │ │
│ │ └───db
│ │ └───changelog
│ │ │ db.changelog-master.xml
│ │ │
│ │ └───1.0
│ │ db.changelog-1.0.xml
│ │ metadata_create.sql
│ │ metadata_insert_data.sql
│ │ metadata_rollback.sql
│ │
│ └───test
│ └───java
├───editor
│ │ pom.xml
│ │
│ └───src
│ ├───main
│ │ ├───java
│ │ └───resources
│ │ │ application.properties
│ │ │
│ │ └───META-INF
│ │ spring.factories
│ │
│ └───test
│ ├───java
│ │ └───ru
│ │ └───test
│ │ └───editor
│ │ └───EditorControllerTest.java
│ │
│ └───resources
│ application.yml
│
│
└───engine
│ pom.xml
│
└───src
├───main
│ ├───java
│ └───resources
│ application.yml
│
└───test
├───java
└───resources
But, When I start tests in editor
, for example (EditorControllerTest.java
), I get error, that Liquibase not found:
Caused by: java.lang.IllegalStateException: Cannot find changelog location: class path resource [db/changelog/db.changelog-master.yaml] (please add changelog or check your Liquibase configuration)
But, I set spring.liquibase.change-log
parameter in application.properties
in database-structure
module. Why it is ignored?
If I specify this option in the editor
module, everything works. How to collect all of the logic work with the Liquibase
in the same place in database-structure
module?
But, I set spring.liquibase.change-log parameter in application.properties in database-structure module. Why it is ignored?
At runtime, as with any resources or classes, the first application.properties found on the classpath at the root (/
) will be picked up the others will be ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With