Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9159173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:25:39+00:00 2026-06-17T13:25:39+00:00

I have Flyway set up in my project with the following directory layout (excluding

  • 0

I have Flyway set up in my project with the following directory layout (excluding irrelevant directories):

$ tree database
database
├── lib
│   ├── flyway-ant-2.0.1.jar
│   ├── flyway-core-2.0.1.jar
│   ├── migrate.jar
│   ├── spring-beans-3.1.2.RELEASE.jar
│   ├── spring-core-3.1.2.RELEASE.jar
│   ├── spring-dao-2.0.8.jar
│   └── spring-jdbc-3.1.2.RELEASE.jar
└── updates
    ├── java
    │   └── database
    │       └── migrate
    │           └── V1_0__create_posts.java
    └── sql
        └── V1_1__create_users.sql

And the relevant part of build.xml (flyway.url and flyway.driver are set in a properties file not included here—Flyway has no problem talking to the database):

<target name="path">
    <path id="migrate.build.path">
        <fileset dir="database/lib">
            <include name="flyway-*.jar"/>
        </fileset>
        <fileset dir="database/lib">
            <include name="spring-*.jar"/>
        </fileset>
    </path>
    <path id="flyway.lib.path">
        <fileset dir="database/lib">
            <include name="flyway-*.jar"/>
        </fileset>
    </path>
    <path id="flyway.classpath">
        <fileset dir="lib" includes="h2-*.jar"/>
        <fileset dir="database/lib" includes="migrate.jar"/>
    </path>
</target>

<target name="compile" depends="path">
    <mkdir dir="build"/>
    <javac srcdir="database/updates/java" destdir="build" includeantruntime="false" classpathref="migrate.build.path"/>
    <copy todir="build">
        <fileset dir="database/updates" excludes="**/*.java"/>
    </copy>
    <jar destfile="database/lib/migrate.jar" basedir="build" includes="sql/**,database/migrate/**"/>
</target>

<target name="init" depends="compile,path">
    <!-- imported tasks -->
    <taskdef uri="antlib:com.googlecode.flyway.ant" resource="com/googlecode/flyway/ant/antlib.xml" classpathref="flyway.lib.path"/>

    <property name="flyway.locations" value="sql,database.migrate"/>
</target>

<!-- flyway tasks -->
<target name="db:clean" depends="init">
    <flyway:clean/>
</target>
<target name="db:init" depends="init">
    <flyway:init/>
</target>
<target name="db:migrate" depends="init">
    <flyway:migrate/>
</target>
<target name="db:validate" depends="init">
    <flyway:validate/>
</target>
<target name="db:info" depends="init">
    <flyway:info/>
</target>
<target name="db:status" depends="init,db:info"/>
<target name="db:repair" depends="init">
    <flyway:repair/>
</target>

Here is the layout of the migrations JAR created in the compile target:

$ unzip -l database/lib/migrate.jar 
Archive:  database/lib/migrate.jar
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  01-14-13 16:27   META-INF/
      103  01-14-13 16:27   META-INF/MANIFEST.MF
        0  01-14-13 16:21   database/
        0  01-14-13 16:27   database/migrate/
        0  01-14-13 16:27   sql/
      538  01-14-13 16:27   database/migrate/V1_0__create_posts.class
        0  01-14-13 16:27   sql/V1_1__create_users.sql
 --------                   -------
      641                   7 files

And here is the output from flyway:info:

[flyway:info] +-------------+------------------------+---------------------+---------+
[flyway:info] | Version     | Description            | Installed on        | State   |
[flyway:info] +-------------+------------------------+---------------------+---------+
[flyway:info] | 0           | << Flyway Init >>      | 2013-01-14 14:14:09 | Missing |
[flyway:info] | 1.1         | create users           |                     | Pending |
[flyway:info] +-------------+------------------------+---------------------+---------+

Flyway is not discovering the .class files. What am I doing wrong here?

Edit: If anyone knows of a working example of Flyway set up with Ant (no Maven, no Ivy), it would be much appreciated.


Update

It turns out Flyway will find JdbcMigration classes, but not SpringJdbcMigration.

This migration is successfully loaded:

/* database/updates/java/database/migrate/V1_0__create_posts.java */
import com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration;
import java.sql.Connection;

public class V1_0__create_posts implements JdbcMigration {
    public void migrate(Connection conn) throws Exception {
        conn.createStatement().execute(
            "create table posts (id integer primary key, title varchar(255), body text)"
        );
    }
}

But this one is skipped:

/* database/updates/java/database/migrate/V1_0__create_posts.java */
import org.springframework.jdbc.core.JdbcTemplate;
import com.googlecode.flyway.core.api.migration.spring.SpringJdbcMigration;

public class V1_0__create_posts implements SpringJdbcMigration {
    public void migrate(JdbcTemplate template) throws Exception {
        template.execute(
            "create table posts (id integer primary key, title varchar(255), body text)"
        );
    }
}

Here is the Ant debug output when using a SpringJdbcMigration:

[antlib:com.googlecode.flyway.ant] Could not load definitions from resource com/googlecode/flyway/ant/antlib.xml. It could not be found.                  [4/873]
[flyway:info] Database: H2 1.2
[flyway:info] DDL Transactions Supported: false
[flyway:info] Schema: PUBLIC
[flyway:info] No metadata table upgrade necessary
[flyway:info] Spring Jdbc available: false
[flyway:info] Scanning for resources at 'database/migrate' (Prefix: 'V', Suffix: '.sql')
[flyway:info] Scanning URL: jar:file:.../flyway-sample/database/lib/migrate.jar!/database/migrate
[flyway:info] JBoss VFS v2 available: false
[flyway:info] Filtering out resource: database/migrate/ (filename: )
[flyway:info] Filtering out resource: database/migrate/V1_0__create_posts.class (filename: V1_0__create_posts.class)
[flyway:info] Scanning for classes at 'database/migrate' (Implementing: 'com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration')
[flyway:info] Scanning URL: jar:file:.../flyway-sample/database/lib/migrate.jar!/database/migrate
[flyway:info] Filtering out resource: database/migrate/ (filename: )
[flyway:info] Scanning for resources at 'db/migration' (Prefix: 'V', Suffix: '.sql')
[flyway:info] Unable to determine URL for classpath location: db/migration (ClassLoader: AntClassLoader[.../flyway-sample/lib/h2-1.2.135.jar:.../flyway-sample/database/lib/migrate.jar])
[flyway:info] Scanning for classes at 'db/migration' (Implementing: 'com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration')
[flyway:info] Unable to determine URL for classpath location: db/migration (ClassLoader: AntClassLoader[.../flyway-sample/lib/h2-1.2.135.jar:.../flyway-sample/database/lib/migrate.jar])
[flyway:info] Scanning for resources at 'sql' (Prefix: 'V', Suffix: '.sql')
[flyway:info] Scanning URL: jar:file:.../flyway-sample/database/lib/migrate.jar!/sql
[flyway:info] Filtering out resource: sql/ (filename: )
[flyway:info] Found resource: sql/V1_1__create_users.sql
[flyway:info] Scanning for classes at 'sql' (Implementing: 'com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration')
[flyway:info] Scanning URL: jar:file:.../flyway-sample/database/lib/migrate.jar!/sql
[flyway:info] Filtering out resource: sql/ (filename: )
[flyway:info] Filtering out resource: sql/V1_1__create_users.sql (filename: V1_1__create_users.sql)
[flyway:info] +-------------+------------------------+---------------------+---------+
[flyway:info] | Version     | Description            | Installed on        | State   |
[flyway:info] +-------------+------------------------+---------------------+---------+
[flyway:info] | 0           | << Flyway Init >>      | 2013-01-14 14:14:09 | Missing |
[flyway:info] | 1.1         | create users           |                     | Pending |
[flyway:info] +-------------+------------------------+---------------------+---------+
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:25:40+00:00Added an answer on June 17, 2026 at 1:25 pm

    Turns out I didn’t have all the Spring JDBC migration dependencies.

    I downloaded the latest Flyway (2.0.3) with Ant & Spring dependencies, added the new JARs to the classpath, and the Spring JDBC migrations are now found by Flyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my open-source database migration project Flyway , I have a feature that cleans
Have the following cronjob set up in root's crontab: (centos 5.x) 2 * *
I'm using the api of flyway 1.7 for migrating a hsql database. I have
Across several projects I have some resources (specifically Flyway database migration scripts) that I'd
I have a project with two modules. Both modules use flyway for migration and
We would love it if Flyway could migrate our database during deployment of an
Flyway is a very nice tool to automate database updates (also called migrations). However,
Have to set expiry date for my app. At present, I am storing the
I have created two different instances of Flyway in 2 different projects in my
Have a long running set of discrete tasks: parsing 10s of thousands of lines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.