When I run maven flyway:migrate
, I get the error
Failed to execute goal org.flywaydb:flyway-maven-plugin:6.5.5:migrate (default-cli) on project myProject: org.flywaydb.core.api.FlywayException: Unable to connect to the database. Configure the url, user and password!
I have my Spring Boot settings in my application.yml file, but I guess the error means it doesn't detect the database config. This documention says, "Spring Boot will then automatically autowire Flyway with its DataSource and invoke it on startup." If I add the configuration to my pom.xml in the flyway plugin section, it connects to the database successfully, but I want it to use my application.yml config. Not the pom.xml. So what am I doing wrong?
Link to repo with issue: https://github.com/jack-cole/BrokenSpringBoot
application.yml
spring:
datasource:
driverClassName: org.postgresql.Driver
url: "jdbc:postgresql://localhost:5433/myDB"
username: postgres
password: test123
Dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jooq</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.16</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>7.0.0</version>
</dependency>
Plugins:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>6.5.5</version>
</plugin>