How do I best work around Flyway issue 156?

2019-02-25 20:35发布

问题:

I'm trying to get Flyway configured and have run up against issue 156, where I can't escape the following message:

[WARNING] Unable to find path for sql migrations: db/migration

The folder exists, contains an sql script named V1__baseline.sql and is relative to the path of both the pom.xml and the current working directory when invoking mvn flyway:migrate.

The relevant section of my pom.xml looks like this:

        <plugin>
            <groupId>com.googlecode.flyway</groupId>
            <artifactId>flyway-maven-plugin</artifactId>
            <version>1.5</version>
            <configuration>
                <serverId>myServer</serverId>
                <driver>com.mysql.jdbc.Driver</driver>
                <url>jdbc:mysql://localhost:3306/myProject</url>
                <table>schema_history</table>
                <baseDir>db/migration</baseDir>
                <basePackage>com.mycompany.myProject.migration</basePackage>
                <validationMode>ALL</validationMode>
            </configuration>
        </plugin>

This appears to be a known problem but there is remarkably little chatter about it given that the first report is from August 2011 and that it still exists in the current stable version (1.5).

You all must be working around it somehow. What's the trick?

回答1:

Issue 156 only applies to OSGi environments.

baseDir refers to a location on the classpath.

In your case this would be: PROJECT_ROOT/src/main/resources/db/migration

Put your migrations there and it should work. I'll have another look at the docs to see if they can be clarified regarding this.



标签: flyway