java - Running Flyway on Command Line doesn't find SpringJdbcMigrations -



java - Running Flyway on Command Line doesn't find SpringJdbcMigrations -

i'm trying set process run flyway command line run our migrations (due restrictions set on my dbas)

i have working nicely part, finding , running sql , normal jdbcmigrations, won't recognize springjdbcmigrations, claiming doesn't have spring jdbc available.

below, find file structure, properties, , debug output flyway:

file construction

flyway.properties

# # license removed brevity # jdbc url utilize connect database flyway.url=jdbc:mysql://localhost:3306/my_project # user utilize connect database (default: <<null>>) flyway.user=root # password utilize connect database (default: <<null>>) flyway.password=xxxxxxx # comma-separated list of locations scan recursively migrations. (default: filesystem:<<install-dir>>/sql) # location type determined prefix. # unprefixed locations or locations starting classpath: point bundle on classpath , may contain both sql , java-based migrations. # locations starting filesystem: point directory on filesystem , may contain sql migrations. flyway.locations=classpath:com.mycompany.myproject.db.migration,filesystem:sql # note: other properties left default

debug output:

[localhost ~/documents/ws-src/flyway-3.0] ./flyway migrate -x /usr/bin/tput flyway (command-line tool) v.3.0 debug: adding location classpath: /users/biggusjimmus/documents/ws-src/flyway-3.0/bin/../jars/java-migration.jar debug: adding location classpath: /users/biggusjimmus/documents/ws-src/flyway-3.0/bin/../jars/mysql-connector-java-5.1.26-bin.jar # # note: library should enable spring jdbc, far know. # debug: adding location classpath: /users/biggusjimmus/documents/ws-src/flyway-3.0/bin/../jars/spring-jdbc-4.0.0.release.jar database: jdbc:mysql://localhost:3306/myproject (mysql 5.6) debug: ddl transactions supported: false debug: schema: myproject # #note: spring-jdbc-4.0.0.release.jar apparently added classpath above! # debug: spring jdbc available: false debug: spring jdbc available: false debug: validating migrations ... debug: scanning classpath resources @ 'com/mycompany/myproject/db/migration' (prefix: 'v', suffix: '.sql') debug: scanning url: jar:file:/users/biggusjimmus/documents/ws-src/flyway-3.0/bin/../jars/java-migration.jar!/com/mycompany/myproject/db/migration debug: jboss vfs v2 available: false debug: filtering out resource: com/mycompany/myproject/db/migration/ (filename: ) debug: filtering out resource: com/mycompany/myproject/db/migration/v1_1_4_2__java_spring_example.class (filename: v1_1_4_2__java_spring_example.class) debug: filtering out resource: com/mycompany/myproject/db/migration/v1_1_4_3__java_nospring_example.class (filename: v1_1_4_3__java_nospring_example.class) debug: scanning classes @ 'com/mycompany/myproject/db/migration' (implementing: 'org.flywaydb.core.api.migration.jdbc.jdbcmigration') debug: scanning url: jar:file:/users/biggusjimmus/documents/ws-src/flyway-3.0/bin/../jars/java-migration.jar!/com/mycompany/myproject/db/migration debug: jboss vfs v2 available: false debug: filtering out resource: com/mycompany/myproject/db/migration/ (filename: ) # # note: why did find nospring illustration (which implements jdbcmigration), # not spring illustration (which implements springjdbcmigration), though # it's in same package? # presumably because doesn't think has spring jdbc back upwards # debug: found class: com.mycompany.myproject.db.migration.v1_1_4_3__java_nospring_example debug: scanning filesystem resources @ 'sql' (prefix: 'v', suffix: '.sql') debug: scanning resources in path: sql (sql) debug: filtering out resource: sql/.ds_store (filename: .ds_store) debug: found filesystem resource: sql/v1_1_3__base_version.sql debug: found filesystem resource: sql/v1_1_4_1__sql_example.sql validated 3 migrations (execution time 00:00.052s) debug: schema `myproject` exists. skipping schema creation. debug: locking table `myproject`.`schema_version`... debug: lock acquired table `myproject`.`schema_version` current version of schema `myproject`: 1.1.3 migrating schema `myproject` version 1.1.4.1 debug: completed , committed migration of schema `myproject` version 1.1.4.1 debug: metadata table `myproject`.`schema_version` updated reflect changes debug: locking table `myproject`.`schema_version`... debug: lock acquired table `myproject`.`schema_version` migrating schema `myproject` version 1.1.4.3 debug: completed , committed migration of schema `myproject` version 1.1.4.3 debug: metadata table `myproject`.`schema_version` updated reflect changes debug: locking table `myproject`.`schema_version`... debug: lock acquired table `myproject`.`schema_version` applied 2 migrations schema `myproject` (execution time 00:00.049s).

if there's other info can provide may helpful, please allow me know.

edit: tried modifying shell shell script add together spring-jdbc jar classpath directly. running modification caused no apparent change.

running alter (on top of updated database, , without debug flag) produced result:

[localhost ~/documents/ws-src/flyway-3.0] sh -x flyway migrate ++ pwd + olddir=/users/biggusjimmus/documents/ws-src/flyway-3.0 + prg=flyway + '[' -h flyway ']' ++ dirname flyway + installdir=. + cd . + '[' -z '' ']' + java_cmd=java + command -v tput /usr/bin/tput ++ tput cols + console_width=116 + java -cp ./bin/flyway-commandline-3.0.jar:./bin/flyway-core-3.0.jar:./jars/spring-jdbc-4.0.0.release.jar org.flywaydb.commandline.main migrate -consolewidth=116 flyway (command-line tool) v.3.0 database: jdbc:mysql://localhost:3306/myproject (mysql 5.6) validated 3 migrations (execution time 00:00.052s) current version of schema `myproject`: 1.1.4.3 schema `myproject` date. no migration necessary. + java_exit_code=0 + cd /users/biggusjimmus/documents/ws-src/flyway-3.0 + exit 0

so, found way create work, requires modification of classpath in "flyway" shell script, seems dubious, , requires inclusion of 5 dependencies, without either behavior described in issue, or classnotfoundexception.

specifically, need add together next libraries jars directory:

commons-logging spring-beans spring-core spring-jdbc spring-tx

and alter https://github.com/flyway/flyway/blob/flyway-3.0/flyway-commandline/src/main/assembly/flyway#l52 to

"$java_cmd" -cp ./bin/flyway-commandline-${project.version}.jar:./bin/flyway-core-${project.version}.jar:./jars/* org.flywaydb.commandline.main $@ -consolewidth=$console_width

or in 4.0, https://github.com/flyway/flyway/blob/master/flyway-commandline/src/main/assembly/flyway#l57

cp="./bin/flyway-commandline-${project.version}.jar:./bin/flyway-core-${project.version}.jar:./jars/*"

is there smarter way this? documented anywhere?

java database-migration flyway

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -