问题
I am using flyway to do the SQL migration , the sql migration worked for me perfectly .
Now am trying to do the simple java migration using Flyway, below is the code which am using
package db.migration;
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
/**
* Example of a Java-based migration.
*/
public class V2__Test implements JdbcMigration {
public void migrate(Connection connection) throws Exception {
PreparedStatement statement =
connection.prepareStatement("create table test (id int)");
try {
statement.execute();
} finally {
statement.close();
}
}
}
I created a Jar file out of this class file and placed the Jar file under Flyway_home/Jars folder. Later I mentioned the db/migration in the config file as below
flyway.locations=db.migration
After this am running the migrate command from cmd utility as below
flyway -configFile=conf/flyway-fte-Data.conf migrate
am getting the below error
ERROR: Unable to scan for SQL migrations in location: classpath:db/migration
What am missing here, could anyone please help me to fix this.
Note: I am not using any plugin, its just flyway command line Utility.
Thanks in advance.
回答1:
The property 'flyway.locations' configures the location of the SQL migration files and you want to run the java migration files. So I think it's enough when you comment out this property in your configuarion, because the Flyway_home/jars folder is the default value for the java migration location property ('flyway.jarDirs'). The next possibility is to set this property ('flyway.jarDirs') to your favour jar location.
来源:https://stackoverflow.com/questions/35571632/unable-to-scan-for-sql-migrations-in-location-classpathdb-migration