I've got two Spring Boot webservices that must both use the same database, same schema and same tables - one service reads from the tables, the other writes to them. Right now one of the services is in development and works with an in-memory DB instead of the real DB, so I can have each service contain its own copy of the database migrations. Once both services are working with the same DB, that won't work - the first one that gets started will run its migrations and the other one will fail. But both projects still have to have the migrations, because they're needed to create in-memory databases for automated tests.
As a solution, I'm making a third project whose only responsibility would be to run the migrations, and both original applications would pull the migrations from this new one, but I'm stuck on how to make that happen.
The closest thing to what I need that I've seen is this code from another SO question:
sourceSets {
main {
resources {
srcDirs += [
project(':data').sourceSets.main.resources
]
}
}
}
But this is for including resources from another local project, not from a gradle dependency. I've got my private Maven repo listed and the dependency resolved, but I'm stumped on what to write instead of the inner line of that block above.
repositories {
mavenCentral()
maven {
url "http://my.repo.link/"
}
}
dependencies {
// other dependencies
runtime 'my.group:database-project:1.0'
}