Flyway Ant构建不迁移

时间:2013-01-09 07:19:03

标签: java eclipse flyway

我使用下面给出的xml文件来执行flyway作为ant任务。我正在使用“Run as ant”选项在eclipse中执行ant文件。它显示构建成功但飞行迁移没有发生。

如果我需要更正,请你检查并告诉我。

                                                                                       

<path id="flyway.lib.path">
    <fileset dir="${flyway.lib.dir}" includes="**/*.jar"/>
</path>

<path id="flyway.classpath">
    <fileset dir="${sql.dir.emlogis}" includes="**/*.sql"/>
    <fileset dir="${sql.dir.generator}" includes="**/*.sql"/>
    <fileset dir="${sql.dir.pgf}" includes="**/*.sql"/>
</path>



<target name="init-flyway">
    <taskdef uri="antlib:com.googlecode.flyway.ant"
                resource="com/googlecode/flyway/ant/antlib.xml"
                classpathref="flyway.lib.path"/>
  <property name="flyway.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
  <property name="flyway.url" value="jdbc:sqlserver://localhost:1433;databaseName=ElmGenerator"/>
  <property name="flyway.user" value="sa"/>
  <property name="flyway.password" value="EmLogis123"/>
  <property name="flyway.baseDir" value="${sql.dir.generator}"/>
  <property name="flyway.classpath" value="${sql.dir.generator}"/>
  <property name="flyway.table" value="schema_history"/>
 <property name="flyway.locations" value="${sql.dir.emlogis},${sql.dir.generator}"/>
    <property name="flyway.placeholders.custName" value="Maple"/>
    <property name="flyway.placeholderPrefix" value="$("/>
    <property name="flyway.placeholderSuffix" value=")"/>
    <property name="flyway.outOfOrder" value="false"/>
    <property name="flyway.validateOnMigrate" value="true"/>
    <property name="flyway.cleanOnValidationError" value="false"/>
    <property name="flyway.initOnMigrate" value="false"/>
</target>

<target name="deployDB" depends="init-flyway">
    <flyway:migrate>
        <locations>
            <location path="${sql.dir.emlogis}"/>
            <location path="${sql.dir.generator}"/>
        </locations>
        <placeholders>
            <placeholder name="custName" value="Elm"/>
        </placeholders>
    </flyway:migrate>
</target>

此致 Kavitha

1 个答案:

答案 0 :(得分:0)

2件事:

  • 不要设置baseDir。它已被地点取代。
  • 位置是flyway.classpath
  • 下面的路径

示例:

flyway.classpath=/my/dir/**.*.sql
flyway.locations=db

然后Flyway将在/ my / dir / db

中查找迁移

您已将类路径和位置设置为相同的值,这是不正确的。