Reputation: 10185
I have very typical application stack: spring-boot:1.5.X
, hibernate:5.X
, maven
and liquibase
.
There is simple to configure liquibase
with spring boot
without adding some configuration files especially for liquibase
.
But I would like to create liquibase changesets
by hibernate entities
. I think i can do it with liquibase-maven-plugin and liquibase-hibernate. Also i have read this article about integration spring boot and liquibase but additional liquibase.properties
needed there.
My question is: how can i configure maven-liqubase plugin without adding some configuration file, if it possible, of course.
Upvotes: 3
Views: 3953
Reputation: 6513
My config is
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<configuration>
<changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>org.mariadb.jdbc.Driver</driver>
<url>jdbc:mariadb://localhost:3306/example</url>
<defaultSchemaName>example</defaultSchemaName>
<username>root</username>
<password>root</password>
<referenceUrl>hibernate:spring:com.example.domain?dialect=org.hibernate.dialect.MySQL5Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
<!-- <verbose>true</verbose> -->
<!-- <logging>debug</logging> -->
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>${liquibase-hibernate5.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.21.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.21.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.21.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.11.17.RELEASE</version>
</dependency>
</dependencies>
</plugin>
which is fine for any mvn liquibase:
command except mvn liquibase:diff
which returns an error for me: [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.6.2:diff (default-cli) on project example: Error setting up or running Liquibase: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory: The application must supply JDBC connections
Upvotes: 1