2012-10-09 2 views

답변

2

당신은 Flyway Ant Tasks를 사용할 수 있습니다. 또한 작업 중 그라데이션 플러그인 (베타 상태)이 있습니다.

예 : 찾을 수

configurations { 
    flyway 
} 

task flywayMigrate(dependsOn: "build") << { 
    ext.flyway_classpath = files(sourceSets.main.output.resourcesDir) + files(configurations.flyway) 
    ant.taskdef(name: 'flywayMigrate', classname: 'com.googlecode.flyway.ant.MigrateTask', classpath: ext.flyway_classpath.asPath) 
    ant.flywayMigrate(driver: 'oracle.jdbc.driver.OracleDriver', url: 'myurl', user: 'myusername', password: 'mypassword', 
      encoding: 'Cp1252', baseDir: 'sql') 
} 

dependencies { 
    compile "com.googlecode.flyway:flyway-core:1.7" 
    compile "com.oracle:ojdbc6:11.2.0.1.0" 
    flyway "com.oracle:ojdbc6:11.2.0.1.0" 
    flyway "com.googlecode.flyway:flyway-ant:1.7" 
} 
+0

시도해 본 결과, "taskdef class com.googlecode.flyway.ant.MigrateTask를 찾을 수 없습니다. 클래스 로더 AntClassLoader를 사용하여 []"도와 주시겠습니까? – priyanka

+0

작업 flyway를 어떻게 호출합니까? – Cengiz

1

내가 쓴 사람은 @ (https://github.com/katta/gradle-flyway-plugin)

간단한 사용이

처럼 보인다
buildscript { 
    repositories { 
    mavenCentral() 
    maven { 
     url uri('http://katta.github.com/repository') 
    } 
    } 
    dependencies { 
    classpath 'org.katta.gradle.api.plugins:flyway:1.3' 
    classpath 'postgresql:postgresql:9.1-901.jdbc4' 
    } 
} 

apply plugin: 'flyway' 

## replace properties with the values with your database settings 
flyway { 
    driver='org.postgresql.Driver' 
    url='jdbc:postgresql://127.0.0.1/flyway' 
    user='postgres' 
    password='s#cRet' 
} 

설명서는 here에 자세히 설명되어 있습니다. 사용하는 데 문제가있을 경우 알려주십시오.

+0

SQL 파일은 어디에 두어야합니까? – Anton

관련 문제