flyway / flyway-ant

Flyway Ant tasks
Apache License 2.0
15 stars 2 forks source link

Use the licensed flyway version #4

Closed altinukshini closed 6 years ago

altinukshini commented 6 years ago

Is there a way to use the licensed flyway version with this plugin?

altinukshini commented 6 years ago

P.S. is there a way we can update the mvn artifact here (https://mvnrepository.com/artifact/org.flywaydb/flyway-ant/4.2.0) to require flyway 5.1.4 instead of 4.2.0. How can we do that?

ttulka commented 6 years ago

org.flywaydb:flyway-ant:4.2.0 is the old version of the Flyway Ant plugin. You have to use cz.net21.flyway.ant:flyway-ant:1.1.4 using the newest Flyway version (currently 5.1.4).

altinukshini commented 6 years ago

Updated to cz.net21.flyway.ant. Any idea what dependencies I'm missing here:

 Caused by: org.flywaydb.core.api.FlywayException: Unable to instantiate class org.flywaydb.core.internal.util.logging.javautil.JavaUtilLogCreator : org.flywaydb.core.internal.util.logging.javautil.JavaUtilLogCreator
 ...
 Caused by: java.lang.ClassNotFoundException: org.flywaydb.core.internal.util.logging.javautil.JavaUtilLogCreator

This is my ant config:

 <path id="flyway.lib.path">
    <fileset dir="framework/base/lib" includes="flyway*.jar"/>
 </path>

 <taskdef resource="org/flywaydb/ant/antlib.xml" uri="antlib:org.flywaydb.ant" classpathref="flyway.lib.path"/>

 <path id="flyway.classpath">
    <fileset  dir="framework/entity/lib/jdbc" includes="postgresql-*.jar" />
 </path>
ttulka commented 6 years ago

The class org.flywaydb.core.internal.util.logging.javautil.JavaUtilLogCreator was already removed from the actual flyway-core source, but it's still included and used by the version 5.1.4. Are you sure the version 5.1.4 is on you classpath? Maybe are you using the actual state of the flyway-core build directly from the source code?

altinukshini commented 6 years ago

Nope, this is my only ivy dependency <dependency org="cz.net21.flyway.ant" name="flyway-ant" rev="1.1.4" conf="flyway-ant->default" /> conf <conf name="flyway-ant" description="Downloads Flyway Ant"/> This downloads also flyway-core-5.1.4.jar automatically, and I don't have any other flyway-core* jar files in the same dir or anywhere elese in my project.

ttulka commented 6 years ago

That's strange. Could you tell me the exact structure of your project in execution? Where are the libs and how is the Ant script setup?

altinukshini commented 6 years ago

Maybe this helps best: https://github.com/apache/ofbiz/tree/release14.12 I've set the flyway paths, taskdef and properties right under the <project ...> tag.

    <path id="flyway.lib.path">
        <!-- include all jars from the Flyway AntLib distribution -->
        <fileset dir="framework/base/lib" includes="flyway*.jar"/>
    </path>

    <path id="flyway.classpath">
        <fileset  dir="framework/entity/lib/jdbc" includes="postgresql-42.2.4.jar" />
    </path>

    <taskdef uri="antlib:org.flywaydb.ant" resource="org/flywaydb/ant/antlib.xml"
             classpathref="flyway.lib.path"/>

    <property name="flyway.locations" value="filesystem:./sql" />
    <property name="flyway.baselineVersion" value="1"/>
    <property name="flyway.baselineOnMigrate" value="true" />
    <property name="flyway.mixed" value="true" />
    <property name="flyway.password" value="PASSWORD"/>
    <property name="flyway.user" value="USERNAME"/>
    <property name="flyway.url" value="jdbc:postgresql://127.0.0.1:5432/DATABASE"/>

    <target name="flyway-build">
        <flyway:repair />
        <flyway:migrate />
        <flyway:info />
    </target>
altinukshini commented 6 years ago

FYI Any older version exc 1.0.0 throws Flyway Error: org.flywaydb.core.api.FlywayException: Unable to instantiate JDBC driver: org.postgresql.Driver => Check whether the jar file is present with the same configuration.

ttulka commented 6 years ago

I will take a look at this.

ttulka commented 6 years ago

I have found the classpath problem and just commited a hotfix. Could you build it by yourself from the source mvn clean package and try it out? I will release a new version with the bugfix later.

altinukshini commented 6 years ago

I confirm this fixed the issue! Thank you so much for the quick fix.

ttulka commented 6 years ago

I thank you for the report and patience! The new release will come soon (propably today).