maven - Flyway callback classpath -


I am using the FlyWay Maven plugin to perform my migration.

I wrote a callback class to go to a resource directory and to run the function / process files. However some files are not found in the resource folders.

I added function files in the folder src / main / resources / db / functions / .

In my flyaway callback code, I call the following code, but I get a null url.

  url = ClassLoader.getSystemResource ("db / functions / mySQL.sql");  

I also tried some variations of receiving system resources, such as adding some variations to more resources before adding classpath .

The same code works if I have created a class with the main method using the Flyway Java API, it seems that there is a classloader problem in Maven. How can I do this?

Two options.

Option 1:

  • Do not forget to compile to ensure that resources are available on the classpath
  • Thread.currentThread ( ). GetContextClassLoader (). GetResourceAsStream ()

Option 2:

  • Use a FileReader

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -