4

I have a similar problem to this but I've migrate to version 2.1.1 and the problem are still here. I just do something like that

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

There is no problem with that cause all work fine in my IDE, but when I package in jar, that not found my migrations ... any ideas ?

Edit: I've already test to put my jar who contain the migration in dependency of a test app who just migrate and the migrations are apply fine ... I don't know what i can do.

Edit I've enabled the FINEST logging and at the moment to find 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)
Community
  • 1
  • 1
agonist_
  • 4,890
  • 6
  • 32
  • 55
  • the debug say nothing, I just have a log before creating the flyway instance who I add, and after this log nothing is print.. that why it's weird. but when I launch on the app test or from my IDE there is no problems migration are done. And it's not on a server, it's a local app with one H2 database. – agonist_ Jul 09 '13 at 12:05
  • yes I display my classpath just before creating my flyway instance. And on my jar I have the sql/migration package here with all migrations. That why I realy don't understand the problem – agonist_ Jul 09 '13 at 16:27
  • I try to clone the git repo and add more log, maybe I'll see the problem .. – agonist_ Jul 10 '13 at 07:48
  • What is the value MIGRATION_PACKAGES ? – Bastian Voigt Jun 20 '14 at 08:20

1 Answers1

1

The default name of the scanned location is db/migration, not sql/migrations. If you want to use sql/migrations instead, set:

flyway.setLocations("sql/migrations");

exception
  • 569
  • 7
  • 20
Bastian Voigt
  • 5,311
  • 6
  • 47
  • 65