My Pom.xml setting for maven plugin is
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>3.0</version>
<!-- Note that we're executing the Flyway
plugin in the "generate-sources" phase -->
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>migrate</goal>
</goals>
</execution>
</executions>
<!-- Note that we need to prefix the db/migration
path with filesystem: to prevent Flyway
from looking for our migration scripts
only on the classpath -->
<configuration>
<baselineOnMigrate>true</baselineOnMigrate>
<url>databaseUrl</url>
<user>username</user>
<password>password</password>
<schemas>
<schema>schema_name</schema>
</schemas>
<locations>
<location>filesystem:src/main/resources/db/migration</location>
</locations>
</configuration>
</plugin>
While running mvn clean install I am getting below error
Failed to execute goal org.flywaydb:flyway-maven-plugin:3.0:migrate (default) on project Test: org.flywaydb.core.api.FlywayException: Found non-empty schema "schema_name" without metadata table! Use init() or set initOnMigrate to true to initialize the metadata table. -> [Help 1]
What am I missing here? I tried some changes like adding baselineOnMigrate but it did not work.
I got the issue, I had to upgrade the version of flyway plugin. I was following an old blog to setup it and in that blog the version of this plugin is 3.0, that is quite old. I upgraded it with latest one. Then after it is working fine.
try to update your Flyway version
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>6.5.6</version>
</plugin>`
hope this help. get more info here https://flywaydb.org/documentation/maven/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.