Redgate Flyway

Community Plugins and Integrations (Dropwizard)

Application startup

While Dropwizard doesn't come with out-of-the-box integration for Flyway you can easily run Flyway on application startup by adding flyway-core to your pom.xml:

<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
    <version>12.8.1</version>
</dependency>

And calling Flyway from your application class:

public class MyApplication extends Application<MyConfiguration> {
    ...

    @Override
    public void run(MyConfiguration configuration, Environment environment) {
        DataSourceFactory dataSourceFactory = configuration.getDataSourceFactory();
        Flyway flyway = new Flyway();
        flyway.setDataSource(dataSourceFactory.getUrl(), dataSourceFactory.getUser(), dataSourceFactory.getPassword());
        flyway.migrate();
        ...
    }
}

CLI add-on

Jochen Schalanda has created a great Dropwizard Add-On that adds Flyway commands to the CLI of your Dropwizard application.

The website also comes with comprehensive documentation on usage and configuration.

This documentation contains proprietary information and is protected by copyright law.
Copyright © 2026 Red Gate Software Limited. All rights reserved


Didn't find what you were looking for?