JHipster Sample Gradle App liquibaseDiffChangelog命令正在抛出一个;未指定驱动程序类别";例外
我正在尝试使Gradle liquibaseDiffChangelog命令与一起工作,并得到以下异常:JHipster Sample Gradle App liquibaseDiffChangelog命令正在抛出一个;未指定驱动程序类别";例外,gradle,jhipster,liquibase-hibernate,Gradle,Jhipster,Liquibase Hibernate,我正在尝试使Gradle liquibaseDiffChangelog命令与一起工作,并得到以下异常: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url ()
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:157)
at liquibase.integration.commandline.Main.doMigration(Main.java:915)
at liquibase.integration.commandline.Main.run(Main.java:180)
at liquibase.integration.commandline.Main.main(Main.java:99)
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url ()
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:247)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:151)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:85)
... 3 common frames omitted
Caused by: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url ()
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:199)
... 5 common frames omitted
:liquibaseDiffChangelog FAILED
我已将liquibase.gradle文件修改为以下内容,以便使用本地MySQL数据库:
configurations {
liquibase
}
dependencies {
liquibase group: 'org.liquibase.ext', name: 'liquibase-hibernate4', version: liquibase_hibernate4_version
}
task liquibaseDiffChangelog(dependsOn: compileJava, type: JavaExec) {
group = "liquibase"
classpath sourceSets.main.runtimeClasspath
classpath configurations.liquibase
main = "liquibase.integration.commandline.Main"
args "--changeLogFile=src/main/resources/config/liquibase/changelog/" + buildTimestamp() +"_changelog.xml"
args "--referenceUrl=hibernate:spring:com.mycompany.myapp.domain?dialect=org.hibernate.dialect.MySQL5Dialect"
args "--username=root"
args "--password=password"
args "--url=jdbc:mysql://localhost:3306/app"
args "--driver=com.mysql.jdbc.Driver"
args "diffChangeLog"
}
def buildTimestamp() {
def date = new Date()
def formattedDate = date.format('yyyyMMddHHmmss')
return formattedDate
}
这些参数看起来都是正确的,并且与本文中使用Maven描述的参数相似
在这个过程中,我是否还遗漏了一些其他步骤,并且在任何地方都找不到记录
我是否需要单独下载MySQL连接器并将其放置在某个位置
JHipster Liquibase没有提到任何其他步骤。问题是,您还需要根据Liquibase配置url,并运行diff。您需要编辑的配置文件是应用程序根目录中gradle文件夹中的Liquibase.gradle:
args "--changeLogFile=src/main/resources/config/liquibase/changelog/" + buildTimestamp() +"_changelog.xml"
args "--referenceUrl=hibernate:spring:io.github.jhipster.sample.domain?dialect=&hibernate.ejb.naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy"
args "--username=jhipsterGradleSampleApplication"
args "--password="
args "--url=jdbc:mysql://localhost:3306/yourDB"
args "--driver=com.mysql.jdbc.Driver"
args "diffChangeLog"
为了使用数据库,您需要更改url、用户名和密码。干杯 问题是,您还需要针对liquibase配置url,并应运行diff。您需要编辑的配置文件是应用程序根目录gradle文件夹中的liquibase.gradle:
args "--changeLogFile=src/main/resources/config/liquibase/changelog/" + buildTimestamp() +"_changelog.xml"
args "--referenceUrl=hibernate:spring:io.github.jhipster.sample.domain?dialect=&hibernate.ejb.naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy"
args "--username=jhipsterGradleSampleApplication"
args "--password="
args "--url=jdbc:mysql://localhost:3306/yourDB"
args "--driver=com.mysql.jdbc.Driver"
args "diffChangeLog"
为了使用数据库,您需要更改url、用户名和密码。干杯 使用o
?dialent=org.hibernate.dialent.mysql5innodbdialent“
使用
?dialent=org.hibernate.dialent.mysql5innodbdialent“