Skip to content

Module-scoped Flyway migrations fail to resolve in GraalVM Native Image #1751

Description

@rivon0507

When running a Spring Modulith application on a standard JVM, module-scoped Flyway migrations are automatically routed and executed correctly from their respective module paths (e.g., db/migration/order/).
However, when compiled into a GraalVM Native Image, the dynamic resource routing mechanism breaks. Instead of scanning the module-scoped directory, Flyway defaults back to scanning the root directory (db/migration/), resulting in a application startup failure because the migration files cannot be located.

Environment

  • Java Version: Java 25 (Oracle GraalVM 25.0.3)
  • Frameworks: Spring Boot 4.1.0, Spring Modulith 2.1.0
  • Database: H2 (In-Memory)

Minimal Reproduction

A self-contained reproduction repository with an automated GitHub Actions validation workflow can be found here:
https://github.com/rivon0507/modulith-flyway-native/

Steps to Reproduce

  1. Clone the reproduction repository.
  2. Compile the native binary using ./gradlew nativeCompile.
  3. Run the generated native executable.

Expected Behavior

Flyway should resolve and execute migrations from the module-scoped path (db/migration/order/).

Actual Behavior

The application crashes at startup with a FlywayException because it searches for the migration scripts directly under the root db/migration/ path instead of the module subfolder.

Metadata

Metadata

Assignees

Labels

in: runtimeGeneral runtime supportmeta: investigatingStuff that needs more investigationtype: bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions