question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java API tutorial doesn't seem to work out of the box

See original GitHub issue

I’m trying to run the tutorial here, using the Java API on a fresh database: http://flywaydb.org/getstarted/firststeps/api.html

Flyway seems to correctly pick up my migration script, but filters out that resource for some reason:

14:15:15,981  INFO [core.internal.dbsupport.DbSupportFactory          ] - Database: jdbc:h2:~/flyway-test (H2 1.3)
14:15:15,983 DEBUG [org.flywaydb.core.Flyway                          ] - DDL Transactions Supported: false
14:15:15,986 DEBUG [org.flywaydb.core.Flyway                          ] - Schema: PUBLIC
14:15:15,991 DEBUG [core.internal.util.FeatureDetector                ] - Spring Jdbc available: true
14:15:15,992 DEBUG [core.internal.command.DbValidate                  ] - Validating migrations ...
14:15:15,997 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Scanning for classpath resources at 'db/migration' (Prefix: 'V', Suffix: '.sql')
14:15:15,997 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Scanning URL: file:/C:/Users/Lukas/workspace/jOOQ/jOOQ-examples/jOOQ-flyway-example/target/classes/db/migration
14:15:15,998 DEBUG [core.internal.util.FeatureDetector                ] - JBoss VFS v2 available: false
14:15:15,999 DEBUG [util.scanner.classpath.FileSystemClassPathLocationScanner] - Scanning starting at classpath root in filesystem: /C:/Users/Lukas/workspace/jOOQ/jOOQ-examples/jOOQ-flyway-example/target/classes/
14:15:15,999 DEBUG [util.scanner.classpath.FileSystemClassPathLocationScanner] - Scanning for resources in path: C:\Users\Lukas\workspace\jOOQ\jOOQ-examples\jOOQ-flyway-example\target\classes\db\migration (db/migration)
14:15:16,000 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Filtering out resource: db/migration/v1__create_author_table.sql (filename: v1__create_author_table.sql)
14:15:16,001 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Scanning for classes at 'db/migration' (Implementing: 'org.flywaydb.core.api.migration.jdbc.JdbcMigration')
14:15:16,001 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Scanning URL: file:/C:/Users/Lukas/workspace/jOOQ/jOOQ-examples/jOOQ-flyway-example/target/classes/db/migration
14:15:16,001 DEBUG [core.internal.util.FeatureDetector                ] - JBoss VFS v2 available: false
14:15:16,001 DEBUG [util.scanner.classpath.FileSystemClassPathLocationScanner] - Scanning starting at classpath root in filesystem: /C:/Users/Lukas/workspace/jOOQ/jOOQ-examples/jOOQ-flyway-example/target/classes/
14:15:16,001 DEBUG [util.scanner.classpath.FileSystemClassPathLocationScanner] - Scanning for resources in path: C:\Users\Lukas\workspace\jOOQ\jOOQ-examples\jOOQ-flyway-example\target\classes\db\migration (db/migration)
14:15:16,001 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Filtering out resource: db/migration/v1__create_author_table.sql (filename: v1__create_author_table.sql)
14:15:16,002 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Scanning for classes at 'db/migration' (Implementing: 'org.flywaydb.core.api.migration.spring.SpringJdbcMigration')
14:15:16,002 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Scanning URL: file:/C:/Users/Lukas/workspace/jOOQ/jOOQ-examples/jOOQ-flyway-example/target/classes/db/migration
14:15:16,002 DEBUG [core.internal.util.FeatureDetector                ] - JBoss VFS v2 available: false
14:15:16,002 DEBUG [util.scanner.classpath.FileSystemClassPathLocationScanner] - Scanning starting at classpath root in filesystem: /C:/Users/Lukas/workspace/jOOQ/jOOQ-examples/jOOQ-flyway-example/target/classes/
14:15:16,002 DEBUG [util.scanner.classpath.FileSystemClassPathLocationScanner] - Scanning for resources in path: C:\Users\Lukas\workspace\jOOQ\jOOQ-examples\jOOQ-flyway-example\target\classes\db\migration (db/migration)
14:15:16,002 DEBUG [util.scanner.classpath.ClassPathScanner           ] - Filtering out resource: db/migration/v1__create_author_table.sql (filename: v1__create_author_table.sql)
14:15:16,013  INFO [core.internal.command.DbValidate                  ] - Validated 0 migrations (execution time 00:00.014s)
14:15:16,015 DEBUG [core.internal.command.DbSchemas                   ] - Schema "PUBLIC" already exists. Skipping schema creation.
14:15:16,023 DEBUG [core.internal.dbsupport.Table                     ] - Locking table "PUBLIC"."schema_version"...
14:15:16,023 DEBUG [core.internal.dbsupport.Table                     ] - Lock acquired for table "PUBLIC"."schema_version"
14:15:16,024  INFO [core.internal.command.DbMigrate                   ] - Current version of schema "PUBLIC": << Empty Schema >>
14:15:16,024  INFO [core.internal.command.DbMigrate                   ] - Schema "PUBLIC" is up to date. No migration necessary.

This leads to no migration being applied.

I’ll obviously figure this one out in a couple of minutes, but I thought that it would be interesting to improve the tutorial to be fail-safe.

Note, it appears that the Spring dependency (which I had in the pom.xml by coincidence) seems to be important, too. Otherwise, without Spring’s ClassPathScanner, it looks like my migration script isn’t picked up at all, with the Java API tutorial’s instructions.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
lukasedercommented, Jun 23, 2014

… OK, less than 5 minutes. It looks like the capital V in the file name is important. How about making that a case-insensitive file prefix requirement? 😃

0reactions
axelfontainecommented, Oct 16, 2014

I decided to leave the tutorial as is for now. Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a REST API - Happy Coding
This tutorial introduces the idea of creating a REST API, which is a way of organizing our code so we can access our...
Read more >
Rest API In Java | Java Tutorial - YouTube
Edureka Java Certification Training: https://www.edureka.co/ java -j2ee-training-course( Use code ...
Read more >
How to Use Buttons, Check Boxes, and Radio Buttons
A group of radio buttons, on the other hand, can have only one button selected. Try this: Click the Launch button to run...
Read more >
Box API Java: How can I move a file into another folder?
Instead of using the updateInfo method, use move(BoxFolder destination) on the file to be moved with the destination folder. Code Sample:
Read more >
REST Security with JWT using Java and Spring Security - Toptal
Note that the name of the Spring Security filter must be exactly springSecurityFilterChain for the rest of the Spring config to work out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found