我的maven插件Pom.xml设置为
<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>
运行mvn全新安装时,我遇到错误
无法执行目标org.flywaydb:flyway-maven-plugin:3.0:migrate (默认)在项目测试中:org.flywaydb.core.api.FlywayException: 找到了没有元数据表的非空模式“ schema_name”!采用 init()或将initOnMigrate设置为true以初始化元数据表。 -> [帮助1]
我在这里想念什么?我尝试了一些更改,例如添加baselineOnMigrate,但是它没有用。
答案 0 :(得分:0)
我遇到了问题,我不得不升级flyway插件的版本。我正在关注一个老博客来对其进行设置,并且在该博客中该插件的版本为3.0,这已经很旧了。我用最新的升级了。然后工作正常。
答案 1 :(得分:0)
尝试更新您的Flyway版本
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>6.5.6</version>
</plugin>`
中获取更多信息