Q:

How to overwrite flyway .sql migration file within a jar from my project?

I am working on a Java application that is modular.
Some of my flyway .SQL migration files are within an installed .jar.
How can I overwrite one of those .sql migration file from within my project so mine get executed for the migration instead of the one provided by the jar?

A:

First, you can extract all files from the jar that you want to change:
jar -xvf filename.jar

Be careful: it will generate a lot of files and folders.
Next, you must find the .sql file and, important, memorize the exactly name. Modify the SQL and, next, execute:
jar uf jar-file input-file(s)

With this command, if the file exists, it will overwrite it. You can execute your .jar with your new file!
I use it with maven jars to modify pom.xml properties and it works. I don't know how your .jar save the .sql files.

