Я пытаюсь создать приложение Spring Boot 2.2.x (Java 13 ) с подходом Code-First с использованием Hibernate и Liquibase. Я хотел бы создать миграцию на основе различий между объектом сущностей и базой данных.
- ОС - Win 10 и Mint 18
- Сборка системы - Gradle 6.0.
- База данных - Postgres SQL.
Я установил утилиты на базе жидкостей (3.8.2).
Мой сценарий gradle:
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.ltgt.gradle:gradle-apt-plugin:0.18'
classpath 'org.postgresql:postgresql:42.2.9'
classpath 'org.liquibase:liquibase-core:3.8.2'
classpath "org.liquibase:liquibase-gradle-plugin:2.0.2"
}
}
plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'org.liquibase.gradle' version '2.0.2'
id 'java'
}
group = 'com.goodt.drive'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '13'
targetCompatibility = '13'
diff.dependsOn compileJava
diffChangeLog.dependsOn compileJava
generateChangelog.dependsOn compileJava
dependencies {
liquibaseRuntime 'org.liquibase:liquibase-core:3.8.2'
liquibaseRuntime "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
liquibaseRuntime 'org.springframework.boot:spring-boot:2.2.1.RELEASE'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
liquibaseRuntime 'org.postgresql:postgresql:42.2.9'
liquibaseRuntime 'org.hibernate:hibernate-core:5.4.10.Final'
liquibaseRuntime 'ch.qos.logback:logback-core:1.2.3'
liquibaseRuntime 'ch.qos.logback:logback-classic:1.2.3'
liquibaseRuntime sourceSets.main.output
}
def dbChangeLog = "$projectDir/src/main/resources/db/changelog/changelog.xml"
def generatedChangeLog = "$projectDir/src/main/resources/db/changelog/generated_changelog.xml"
liquibase {
activities {
main {
changeLogFile dbChangeLog
outputFile generatedChangeLog
driver "org.postgresql.Driver"
classpath "$projectDir/lib/postgresql-42.2.9.jar"
url "jdbc:postgresql://localhost:5432/webportal"
username "developer"
password "123"
referenceUrl "hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect"
//referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
}
}
}
Когда я запускаю команду diff, основанную на сценарии gradle, например: . \ Gradlew.bat diff Я получаю следующий вывод:
> Task :diff
liquibase-plugin: Running the 'main' activity...
12:48:14.372 INFO [liquibase.integration.commandline.Main]: Starting Liquibase at ёЁ, 15 эт. 2020 12:48:14 YEKT (version 3.8.2 #26 built at Tue Nov 26 04:53:39 UTC 2019)
12:48:15.323 INFO [liquibase.integration.commandline.Main]: No Liquibase Pro license key supplied. Please set liquibaseProLicenseKey on command line or in liquibase.properties to use Liquibase Pro features.
12:48:15.325 INFO [liquibase.integration.commandline.Main]: Liquibase Community 3.8.2 by Datical
12:48:15.614 ERROR [liquibase.integration.commandline.Main]: Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
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 (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:132)
at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:1604)
at liquibase.integration.commandline.Main.doMigration(Main.java:1200)
at liquibase.integration.commandline.Main.run(Main.java:229)
at liquibase.integration.commandline.Main.main(Main.java:143)
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 (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:263)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:149)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:97)
... 4 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 (hibernate:spring:com.wissance.webportal.application.model.entities?dialect=org.hibernate.dialect.PostgreSQL94Dialect)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:200)
... 6 common frames omitted