我不明白他为什么不喜欢这条路,一切都拼写正确。
应用程序属性:
spring.jpa.hibernate.ddl-auto=validate
spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.xml
liquibase.properties
classpath=
changeLogFile= db/changelog/db.changelog-master.xml
url= jdbc:postgresql://localhost:5432/new
username= root
password= 123
driver= org.postgresql.Driver
pom.xml org.liquibase liquibase-maven-plugin 3.6.3
db.changelog-master.xml
<changeSet id="0" author="blacit">
<tagDatabase tag="db_init"/>
</changeSet>
<include file="v-1.0/db.changelog-v.1.0.xml" relativeToChangelogFile="true"/>
<changeSet id="7" author="blacit">
<tagDatabase tag="v.1.0"/>
</changeSet>
<propertyFile>${project.basedir}/src/main/resources/liquibase.properties</propertyFile>
</configuration>
</plugin>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: liquibase.exception.SetupException: Error Reading Migration File: class path resource [db/changelog/v-1.0/01-changeset-users.xml] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1803) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
at task.homerent.Application.main(Application.java:34) ~[classes/:na]
Caused by: liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: liquibase.exception.SetupException: Error Reading Migration File: class path resource [db/changelog/v-1.0/01-changeset-users.xml] cannot be resolved to URL because it does not exist
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ~[liquibase-core-3.8.0.jar:na]
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217) ~[liquibase-core-3.8.0.jar:na]
at liquibase.Liquibase.update(Liquibase.java:190) ~[liquibase-core-3.8.0.jar:na]
at liquibase.Liquibase.update(Liquibase.java:179) ~[liquibase-core-3.8.0.jar:na]
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:366) ~[liquibase-core-3.8.0.jar:na]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:314) ~[liquibase-core-3.8.0.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1862) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
... 18 common frames omitted
Caused by: liquibase.exception.SetupException: liquibase.exception.SetupException: Error Reading Migration File: class path resource [db/changelog/v-1.0/01-changeset-users.xml] cannot be resolved to URL because it does not exist
at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:359) ~[liquibase-core-3.8.0.jar:na]
at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:308) ~[liquibase-core-3.8.0.jar:na]
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:23) ~[liquibase-core-3.8.0.jar:na]
... 25 common frames omitted
Caused by: liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Error Reading Migration File: class path resource [db/changelog/v-1.0/01-changeset-users.xml] cannot be resolved to URL because it does not exist
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ~[liquibase-core-3.8.0.jar:na]
at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:568) ~[liquibase-core-3.8.0.jar:na]
at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:351) ~[liquibase-core-3.8.0.jar:na]
... 27 common frames omitted
Caused by: liquibase.exception.SetupException: Error Reading Migration File: class path resource [db/changelog/v-1.0/01-changeset-users.xml] cannot be resolved to URL because it does not exist
at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:359) ~[liquibase-core-3.8.0.jar:na]
at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:308) ~[liquibase-core-3.8.0.jar:na]
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:23) ~[liquibase-core-3.8.0.jar:na]
... 29 common frames omitted
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: class path resource [db/changelog/v-1.0/01-changeset-users.xml] cannot be resolved to URL because it does not exist
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:118) ~[liquibase-core-3.8.0.jar:na]
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15) ~[liquibase-core-3.8.0.jar:na]
at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:568) ~[liquibase-core-3.8.0.jar:na]
at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:351) ~[liquibase-core-3.8.0.jar:na]
... 31 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [db/changelog/v-1.0/01-changeset-users.xml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195) ~[spring-core-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:613) ~[liquibase-core-3.8.0.jar:na]
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:186) ~[liquibase-core-3.8.0.jar:na]
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:71) ~[liquibase-core-3.8.0.jar:na]
... 34 common frames omitted
文件路径无效 - 读取迁移文件时出错:类路径资源 [db/changelog/v-1.0/01-changeset-users.xml]
db/changelog/v-1.0/01-changeset-users.xml ,文件名不同 - 01-changeset-users-table.xml