Issue 94 in flyway: "Found more than one migration" error for duplicate resources

2,292 views
Skip to first unread message

fly...@googlecode.com

unread,
Feb 16, 2011, 10:31:57 AM2/16/11
to flywa...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 94 by cow...@bbs.darktech.org: "Found more than one migration"
error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

In some cases, both src/main/resources and target/classes end up on the
classpath. One such case is discussed here:
http://netbeans.org/bugzilla/show_bug.cgi?id=195374

In such a case, Flyway complains:

Found more than one migration with version: X
at
com.googlecode.flyway.core.migration.MigrationProvider.doFindAvailableMigrations(MigrationProvider.java:153)
at
com.googlecode.flyway.core.migration.MigrationProvider.findAvailableMigrations(MigrationProvider.java:114)
at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:488)
at foo.MapperTest.clearDatabase(MapperTest.java:28)

I am proposing the following change:

1. Either Flyway should ignore duplicate migrations so long as they have
the same relative path (db/migration relative to src/main/resources or
target/classes). Or,

2. Flyway can scan potentially conflicting migrations and skip any files
with duplicate contents.

fly...@googlecode.com

unread,
Feb 19, 2011, 5:11:00 PM2/19/11
to flywa...@googlegroups.com

Comment #1 on issue 94 by everf...@gmail.com: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

I have the same problem with Netbeans. In my point of view flyway is doing
the right thing, and netbeans is faulty.
A work around in netbeans is to do a "clean" before "test" or "run" of the
project.

fly...@googlecode.com

unread,
Feb 19, 2011, 6:02:16 PM2/19/11
to flywa...@googlegroups.com

Comment #2 on issue 94 by axel.fontaine.business: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

I also feel that NetBeans is a bit quick here with blaming everyone else,
except themselves about this issue.

Is this workaround a reasonable (and workable) solution?

fly...@googlecode.com

unread,
Feb 19, 2011, 6:10:19 PM2/19/11
to flywa...@googlegroups.com

Comment #3 on issue 94 by everf...@gmail.com: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

I did not test it with debugging, neither am I sure whether it will be
fixed with Netbeans 7.
Running a "clean" worked for me in NB 6.9.1 when doing junit tests and some
dirty "main-class-run" hacks.

fly...@googlecode.com

unread,
Mar 20, 2011, 9:49:23 AM3/20/11
to flywa...@googlegroups.com

Comment #4 on issue 94 by cow...@bbs.darktech.org: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

Last time I asked the Netbeans committers, there were no plans on changing
this. There are two separate problems here:

1. Source directory must be in the classpath in order for Netbeans'
compile-on-save to work.

2. Maven has no way to differentiate between test compile-time classpath
and test runtime classpath. We want the former to contain src but the
latter to omit it.

fly...@googlecode.com

unread,
Mar 30, 2011, 3:41:56 PM3/30/11
to flywa...@googlegroups.com

Comment #5 on issue 94 by everf...@gmail.com: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

Another hint to work around the Netbeans problem: If you have a web
application, you can run maven from a separate shell (even a shell in
Netbeans).
I never experienced any trouble after beeing aware that you have to "clean"
or "clean and build" after renaming migrations or before launching from
Netbeans directly.
(I would suggest to make a hint in the documentation and close this, it is
not a flyway bug and flyway should really abort in inconsistent situations.)

fly...@googlecode.com

unread,
Mar 30, 2011, 4:29:22 PM3/30/11
to flywa...@googlegroups.com

Comment #6 on issue 94 by cow...@bbs.darktech.org: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

I disagree. Flyway isn't reporting an inconsistent situation. It's
complaining that the same file is found twice on the classpath. Today the
problem is Netbeans, tomorrow it will be something else.

Please recall that I filed this issue because I was having problems
debugging unit tests. "clean and build" won't help in this case.

fly...@googlecode.com

unread,
Mar 30, 2011, 5:24:21 PM3/30/11
to flywa...@googlegroups.com

Comment #7 on issue 94 by mathias....@gmail.com: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

Having this issue as well with Play! Framework. Flyway should use the
checksum of the file to check for versions.

fly...@googlecode.com

unread,
May 11, 2011, 8:14:39 AM5/11/11
to flywa...@googlegroups.com
Updates:
Status: Accepted
Labels: Milestone-Release-1.4

Comment #8 on issue 94 by axel.fontaine.business: "Found more than one

migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

Fixed. Exact duplicates are now filtered out.

fly...@googlecode.com

unread,
May 11, 2011, 8:22:42 AM5/11/11
to flywa...@googlegroups.com
Updates:
Status: Fixed

Comment #9 on issue 94 by axel.fontaine.business: "Found more than one

migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

This issue was closed by revision e593e800c30b.

fly...@googlecode.com

unread,
May 11, 2011, 8:34:53 AM5/11/11
to flywa...@googlegroups.com

Comment #10 on issue 94 by axel.fontaine.business: "Found more than one
migration" error for duplicate resources
http://code.google.com/p/flyway/issues/detail?id=94

Issue 114 has been merged into this issue.

Reply all
Reply to author
Forward
0 new messages