我正在尝试使用liquibase-gradle-plugin在数据库和Springboot实体之间生成数据库差异。但是,我总是得到错误说
liquibase.exception.LiquibaseException:运行Liquibase时出现意外错误:java.lang.RuntimeException:找不到数据库驱动程序:class org.postgresql.Driver
我根据一些谷歌搜索结果将类路径依赖项放在buildscripts块中。但它没有帮助。下面是我的build.gradle
buildscript {
ext {
springBootVersion = '1.5.6.RELEASE'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/milestone" }
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('org.postgresql:postgresql:9.4.1212')
}
}
//When the liquibase plugin is applied, it creates a Gradle task for each command supported by Liquibase.
plugins {
id 'org.liquibase.gradle' version '1.2.4'
}
apply from: 'liquibase.gradle'
liquibase {
activities {
diffMain {
url gradle.ext.url
username gradle.ext.username
password gradle.ext.password
referenceUrl gradle.ext.referenceUrl
driver org.postgresql.Driver
}
}
runList = 'diffMain'
}