Spring Boot集成Flyway数据库迁移时数据库连接失败问题求助
Spring Boot集成Flyway数据库迁移时数据库连接失败问题求助
大家早上好,我正在为自己的应用搭建后端,打算用Flyway来做数据库迁移。
我已经在pom.xml中添加了所需的依赖:
<dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-core</artifactId> </dependency> <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-database-postgresql</artifactId> <version>10.15.0</version> </dependency>
同时也配置了application.yml文件:
spring: datasource: username: speed url: jdbc:postgresql://localhost:5432/DBManage password: userpass66! jpa: properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect format_sql: 'true' hibernate: ddl-auto: update show-sql: 'true' flyway: driverClassName: org.postgresql.Driver enabled: true baseline-on-migrate: true user: speed password: userpass66!
不过在VSCode中使用Flyway插件执行迁移时,我遇到了以下错误:
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:10.20.1:migrate (default-cli) on project backend: org.flywaydb.core.api.FlywayException: Unable to connect to the database. Configure the url, user and password! -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
我已经在db\migration目录下创建了所有必要的迁移文件,有没有人能帮我分析下为什么会出现这个连接错误?谢谢大家!
备注:内容来源于stack exchange,提问作者Speedkillsx




