Passing flyway.target and flyway.initVersion property to flywayMigrate gradle task results in cast exception error -
attempting pass target property flywaymigration gradle task
gradle flywaymigrate -d -pflyway.target='1.0.0'
or
gradle flywaymigrate -d -pflyway.target=1.0.0
or
flyway { url = 'jdbc:h2:file:target/foobar' user = 'sa' target = '1'}
fails org.codehaus.groovy.runtime.typehandling.groovycastexception
09:08:25.855 [error] [org.gradle.buildexceptionreporter] caused by: org.codehaus.groovy.runtime.typehandling.groovycastexception: cannot cast object '1.0.0' class 'java.lang.string' class 'com.googlecode.flyway.core.api.migrationversion'
versions , platforms used:
'com.googlecode.flyway:flyway-gradle-plugin:2.2' gradle -version gradle 1.6 gradle build time: tuesday 07 may 2013 9:12:14 groovy: 1.8.6 ant: apache ant(tm) version 1.8.4 compiled on may 22 2012 ivy: 2.2.0 jvm: 1.7.0_05 (oracle corporation 23.1-b03) os: mac os x 10.8.3 x86_64
it appears affects when 1 attempts set 2 properties:
- target
- initversion
on closer both methods have overridden setters accept different types argument:
sets version tag existing schema when executing init. parameters: initversion version tag existing schema when executing init. (default: 1) 740 741 public void setinitversion(migrationversion initversion) { 742 this.initversion = initversion; 743 } sets version tag existing schema when executing init. parameters: initversion version tag existing schema when executing init. (default: 1) 749 750 public void setinitversion(string initversion) { 751 this.initversion = new migrationversion(initversion); 752 }
however appears in gradle target setting priorities groovy not matching correct override type when invoking setter on 2 methods:
/** * sets property on flyway instance if value has been defined. * @param flyway flyway instance. * @param property property set. */ private void propset(flyway flyway, string property) { def value = prop(property); if (value != null) { flyway[property] = value; } }
issue 574 has been opened flyway perhaps can share more insights on correct usage setting above mentioned properties.
Comments
Post a Comment