【发布时间】:2016-10-26 21:45:15
【问题描述】:
在我的 pom.xml 中配置 liquibase 之后。我还在资源文件夹 changelog.xml 中添加了这些文件,这就是内容
<databaseChangeLog xmlns='http://www.liquibase.org/xml/ns/dbchangelog'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd'>
<changeSet id="001" author="Dev">
<sql>
ALTER TABLE book ADD COLUMN address VARCHAR(1024);
</sql>
</changeSet>
</databaseChangeLog>
我还在资源文件夹中添加了这个文件 liquibase.properties,这就是内容
contexts: ${liquibase.contexts}
changeLogFile: src/main/resources/changelog.xml
driver: ${jdbc.driverClassName}
url: ${jdbc.url}
username: ${jdbc.username}
verbose: true
dropFirst: false
我也像这样配置了我的 pom.xml
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.0.5</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
当我启动我的项目时,我从 tomcat 收到此错误
Caused by: java.lang.RuntimeException: Cannot run Liquibase, liquibase.datasource is not set
请问有什么问题?
【问题讨论】:
-
您是否启用了资源过滤(使用 maven)?
-
请给我看看
-
我创建了一个chat room。也许我可以给你一些提示......
标签: java spring hibernate maven liquibase