Flyway does not find migraines only in my jar file

I have a similar problem with this , but I switched to version 2.1.1 and the problem is still here. I'm just doing something like this

Flyway flyway = new Flyway(); flyway.setLocations(MIGRATION_PACKAGES); flyway.setDataSource(getDatasource()); flyway.setTable("schema_version"); flyway.setSqlMigrationPrefix("v"); flyway.migrate(); 

There is no problem that everything works fine in my IDE, but when I pack in a jar, it didnโ€™t find my migrations ... any ideas?

Edit: I already tested to put my jar, which contains the transfer depending on the test application, which is just portable, and the migrations apply perfectly ... I do not know what I can do.

Change I turned on FINEST log and currently detected a migration

 FINE: Scanning for resources at 'db/migration' (Prefix: 'v', Suffix: '.sql') juil. 10, 2013 4:44:53 PM com.googlecode.flyway.core.util.scanner.ClassPathScanner findResourceNames FINE: Unable to determine URL for classpath location: db/migration (ClassLoader: java.net.URLClassLoader@6458c2 ) juil. 10, 2013 4:44:53 PM com.googlecode.flyway.core.util.scanner.ClassPathScanner scanForClasses FINE: Scanning for classes at 'db/migration' (Implementing: 'com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration') juil. 10, 2013 4:44:53 PM com.googlecode.flyway.core.util.scanner.ClassPathScanner findResourceNames FINE: Unable to determine URL for classpath location: db/migration (ClassLoader: java.net.URLClassLoader@6458c2 ) juil. 10, 2013 4:44:53 PM com.googlecode.flyway.core.util.scanner.ClassPathScanner scanForResources FINE: Scanning for resources at 'com/me/myapp/sql/migration' (Prefix: 'v', Suffix: '.sql') juil. 10, 2013 4:44:53 PM com.googlecode.flyway.core.util.scanner.ClassPathScanner findResourceNames FINE: Unable to determine URL for classpath location: com/me/myapp/sql/migration (ClassLoader: java.net.URLClassLoader@6458c2 ) juil. 10, 2013 4:44:53 PM com.googlecode.flyway.core.util.scanner.ClassPathScanner scanForClasses FINE: Scanning for classes at 'com/me/myapp/sql/migration' (Implementing: 'com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration') juil. 10, 2013 4:44:53 PM com.googlecode.flyway.core.util.scanner.ClassPathScanner findResourceNames FINE: Unable to determine URL for classpath location: com/me/myapp/sql/migration (ClassLoader: java.net.URLClassLoader@6458c2 ) 
+4
source share
1 answer

By default, db/migration specified for the scanned location, not sql/migrations . If you want to use sql/migrations instead, install:

flyway.setLocations("sql/migrations");

0
source

Source: https://habr.com/ru/post/1489754/


All Articles