FlywayException: Unable to scan for SQL migrations in location: classpath:db/migration

I'm trying to start using flyway with maven integration but can't make it work.

I'm following the documentation seems to be very simple so no strange things seem to be done.

My pom.xml is the following:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

            <!-- Flyway plugin configuration -->


        <!-- DB dependencies -->

        <!-- Test dependencies -->

I have the directory resources/db/migration/ without any migration yet.

When I issuing flyway:info on cygwin or cmd I got an flyway error:

$ mvn compile flyway:info
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.test:test:jar:0.0.1-SNAPSHOT
[INFO]    task-segment: [compile, flyway:info]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [flyway:info {execution: default-cli}]
[INFO] Database: jdbc:mysql://localhost:3306/test (MySQL 5.5)
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] org.flywaydb.core.api.FlywayException: Unable to scan for SQL migrations in location: classpath:db/migration

Embedded error: Unable to determine URL for classpath location: db/migration (ClassLoader: org.codehaus.classworlds.RealmClassLoader@5bcdbf6)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue May 06 11:06:15 CST 2014
[INFO] Final Memory: 17M/223M
[INFO] ------------------------------------------------------------------------

Can give me a hand on this?

Thans a lot.


This also happens if the compile goal is not executed before calling flyway:migrate. Actually this IS included in the quick start manual. It says:

mvn compile flyway:migrate

However if you miss that detail and start to just call mvn flyway:migrate, the SQL file will not get copied into the target directory (actually the target directory will not even exist) and you get this cryptic error.

Well, just for you to know.

I found the problem, it happens when we setup flyway in our environment but we don't have any migration to be executed.

It shouldn't display a classpath error but fortunately it's working.

By the way, another problem I found is that after executing init if we check with info nothing is displayed. And if we add a new migration with V1 then info won't show it unless we change it to V1_1

Hope to help

I ran into the same problem. In my case, I had my migration script in the wrong directory that had caused the issue. I moved the script V1__Create_person_table.sql to the right directory at resources/db/migration/ and it worked!!

I faced the same issue. But when i obeserved the logs keenly i found flywaydb is looking in db/migration folder for the script but my script is in db/migrate. so, after correcting the path from db/migrate to db/migration it works!!.

Here's a dumb mistake I've made where I got this pesky error:

Make sure you set your packaging as jar not pom in your pom.xml. Then mvn install and make sure you have a jar for that project in your M2 folder otherwise you will get this error since the migration file wasn't copied over and found.

I had a similar problem too. in my case i thought i had named the directories correctly after triple checking everything. Turned out that i typed migrations instead of migration. As soon as i fixed this everything was fine.

Just before this i had another issue with the underscore after the version marker (V1) in the migration filename. It needs to be a dunder (double underscore) so its always V1__description.sql .

Seems like none of the flyway issues i encounter are big mess-up's. it's always something small that can be easily fixed. It's just about finding out what the problem is. That's the hard part.

Need Your Help

Parsing comment with antlr

c parsing comments antlr

I'm using ANTLR to parse a custom data definition language. I'm using C as language and I'm outputting an abstract syntax tree. So far so good, but now I need to add documentation and I need to allow

Rails 4 on Heroku: web dyno serving old assets, while other serve new

heroku ruby-on-rails-4 assets

This issue has just recently come up in our last several pushes to Heroku since upgrading to Rails 4. My application has two web dynos. What I've been able to find through troubleshooting is that I'm