Liquibase cannot find my entity classes(JPA annotated) inside given package to generate diff.
when I use mvn liquibase:diff
command It says No changes found, nothing to do but my entities have new fields
I use spring framweork, JPA(hibernate), Liquibase, liquibase-hibernate
and here are my codes:
liquibase.properties
referenceUrl=hibernate:spring:model.entity.persistent?dialect=org.hibernate.dialect.OracleDialect
changeLogFile=src/main/resources/liquibase-changeLog.xml
url=jdbc:oracle:thin:@localhost:1521:xe
username=username
password=password
driver=oracle.jdbc.OracleDriver
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog-8.xml
pom.xml liquibase-hibernate config
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate4</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.19</version>
</dependency>
</dependencies>
</plugin>
I tried with the following..
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<propertyFile>liquibase.properties</propertyFile>
<changeLogFile>changelogs/db.changelog-master.xml</changeLogFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.19</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
liquibase.properties
referenceUrl=hibernate:spring:ch.karthi.liquibase.jpa.update.entities?dialect=org.hibernate.dialect.MySQL5Dialect
referenceDriver=liquibase.ext.hibernate.database.connection.HibernateDriver
referenceDefaultSchemaName=liquibasetest
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/liquibasetest
username=USERNAME
password=PASSWORD
defaultSchemaName=liquibasetest
changeLogFile=src/main/resources/liquibase-changeLog.xml
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog-8.xml
outputChangeLogFile=src/main/resources/liquibase-changeLog.xml
and it worked without any problem.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building liquibase-jpa-update 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- liquibase-maven-plugin:3.5.3:diff (default-cli) @ liquibase-jpa-update ---
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO] File: liquibase.properties
[INFO] 'outputChangeLogFile' in properties file is not being used by this task.
[INFO] ------------------------------------------------------------------------
[INFO] Executing on Database: jdbc:mysql://127.0.0.1:3306/liquibasetest
INFO 05.01.18, 12:58: liquibase-hibernate: Reading hibernate configuration hibernate:spring:ch.karthi.liquibase.jpa.update.entities?dialect=org.hibernate.dialect.MySQL5Dialect
INFO 05.01.18, 12:58: liquibase-hibernate: Found package ch.karthi.liquibase.jpa.update.entities
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
WARNING: An illegal reflective access operation has occurred
WARNING: Please consider reporting this to the maintainers of javassist.util.proxy.SecurityActions
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO 05.01.18, 12:58: liquibase-hibernate: Using dialect org.hibernate.dialect.MySQL5Dialect
[INFO] Performing Diff on database root@localhost @ jdbc:mysql://127.0.0.1:3306/liquibasetest (Default Schema: liquibasetest)
INFO 05.01.18, 12:58: liquibase-hibernate: Found table Customer
INFO 05.01.18, 12:58: liquibase-hibernate: Found table Customer
INFO 05.01.18, 12:58: liquibase-hibernate: Found table Customer
INFO 05.01.18, 12:58: liquibase-hibernate: Found primary key CustomerPK
INFO 05.01.18, 12:58: liquibase-hibernate: Found column id integer
INFO 05.01.18, 12:58: liquibase-hibernate: Found column age integer
INFO 05.01.18, 12:58: liquibase-hibernate: Found column name varchar(255)
INFO 05.01.18, 12:58: liquibase-hibernate: Found column sexString varchar(255)
INFO 05.01.18, 12:58: liquibase: src/main/resources/liquibase-diff-changeLog-8.xml exists, appending
[INFO] Differences written to Change Log File, src/main/resources/liquibase-diff-changeLog-8.xml
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.328 s
[INFO] Finished at: 2018-01-05T12:58:37+01:00
[INFO] Final Memory: 25M/85M
[INFO] ------------------------------------------------------------------------
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With