I have the following problem.
I have maven multi modules project, with the following structure:
Parent
|
|_____DB-Setup
| |______V1__init.sql
| |______V1.1__update.sql
|
|_____Modul1
| |____src/*
|
|_____Modul2
|____src/*
How can I using maven say Flyway that my SQL scripts located under Parrent/DB-Setap?
thx.
<!--FlyWay -->
<plugin>
<groupId>com.googlecode.flyway</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<url>jdbc:xxxx</url>
<user>xxx</user>
<password>xxx</password>
<validateOnMigrate>true</validateOnMigrate>
</configuration>
</plugin>
thx.
You have three options:
Turn DB-Setup into a proper Maven module and let they other modules depend on it. Place the scripts under DB-Setup/src/main/resources. You will then be able to use both the Flyway Maven plugin and the API directly from the other modules.
Turn DB-Setup into a proper Maven module and execute the Flyway Maven plugin there.
Keep DB-Setup as a simple directory and use a filesystem: location in the Flyway Maven plugin configuration to refer to the path where the sql migrations are stored.
My preference is either #1 or #2.
Flyway is looking in your classpath
for the directory db/migration
.
So if you put your scripts under DB-Setup/db/resources
it should be fine.
Alternatively, you can override the locations
property of Flyway like explained here:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.