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.
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.
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?
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.
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.
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.)
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.
Having this issue as well with Play! Framework. Flyway should use the
checksum of the file to check for versions.
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.
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.
Issue 114 has been merged into this issue.