First, you should never call execute()
on a task (bad things will happen). Also, a task will be executed at most once per Gradle invocation.
To answer your question, apparently the flyway plugin doesn't support having multiple tasks of the same type. Looking at its implementation, I think you'll have to roll your own task. Something like:
import com.googlecode.flyway.core.Flyway
import org.katta.gradle.plugin.flyway.task.AbstractFlywayTask
class MigrateOtherDb extends AbstractFlywayTask {
@Override
void executeTask(Flyway flyway) {
// set any flyway properties here that differ from
// those common with other flyway tasks
println "Executing flyway migrate"
flyway.migrate()
}
task migrateOtherDb(type: MigrateOtherDb)
I recommend to file a feature request to support multiple tasks of the same type, with a convenient way to configure them.