Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

[Dúvida] Não consigo iniciar projeto com flyway

Depois de criar os arquivos sql tive problemas para iniciar o projeto, ele não aponta nenhum arquivo especifico, apenas dá isso, mesmo no maven com --debug

th version 1
Offenders:
-> C:\Users\renan\Desktop\Projetos\Java\api\target\classes\db\migration\V1__create-table-medicos.sql (SQL)
-> C:\Users\renan\Desktop\Projetos\Java\api\target\classes\db\migration\V1__create-table-endereco.sql (SQL)
2022-12-04T15:29:39.315-03:00  INFO 7912 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2022-12-04T15:29:39.318-03:00  INFO 7912 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2022-12-04T15:29:39.320-03:00  INFO 7912 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-12-04T15:29:39.330-03:00  INFO 7912 --- [  restartedMain] .s.b.a.l.ConditionEvaluationReportLogger :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2022-12-04T15:29:39.343-03:00 ERROR 7912 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Found more than one migration with version 1
Offenders:
-> C:\Users\renan\Desktop\Projetos\Java\api\target\classes\db\migration\V1__create-table-medicos.sql (SQL)
-> C:\Users\renan\Desktop\Projetos\Java\api\target\classes\db\migration\V1__create-table-endereco.sql (SQL)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130) ~[spring-context-6.0.2.jar:6.0.2]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905) ~[spring-context-6.0.2.jar:6.0.2]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.2.jar:6.0.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.1-SNAPSHOT.jar:3.0.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.1-SNAPSHOT.jar:3.0.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.1-SNAPSHOT.jar:3.0.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.1-SNAPSHOT.jar:3.0.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[spring-boot-3.0.1-SNAPSHOT.jar:3.0.1-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[spring-boot-3.0.1-SNAPSHOT.jar:3.0.1-SNAPSHOT]
        at app.medico.api.ApiApplication.main(ApiApplication.java:14) ~[classes/:na]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-3.0.1-SNAPSHOT.jar:3.0.1-
2 respostas

Mesmo problema por aqui.

solução!

Oi Carlos!

O erro: Found more than one migration with version 1

Você deve ter duas ou mais migrations com o mesmo prefixo V1. Cada migration deve ter um numero distinto: V1, V2, V3, etc.

Bons estudos!