2016-04-11 2 views
4

У меня есть весенний ботинок, проект весенних данных jpa с родительским и тремя дочерними модулями. Один из моих модулей отвечает за мои сущности JPA. Мне нужно создать один xml-журнал изменений с ликбазой из этих сущностей.Liquibase генерирует журнал изменений из объектов JPA

В моем liquibase.properties у меня есть код:

changeLogFile=src/main/resources/db/changelog/db.changelog-master.xml 
url=jdbc:mysql://localhost:3306/test 
username=root 
password=root 
driver=com.mysql.jdbc.Driver 
outputChangeLogFile=src/main/resources/db/outputChangeLog/liquibase-outputChangeLog.xml 
referenceUrl=hibernate:spring:br.com.company.vacation.domain?dialect=org.hibernate.dialect.MySQLDialect 
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog.xml 

Так что, если я пытаюсь выполнить команду: LiquiBase: Diff я получаю ошибку:

В моей pom.xml я настроил LiquiBase так же, как это:

<plugin> 
    <groupId>org.liquibase</groupId> 
    <artifactId>liquibase-maven-plugin</artifactId> 
    <version>3.4.1</version> 
    <configuration> 
     <propertyFile>src/main/resources/liquibase.properties</propertyFile> 
    </configuration> 
     <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> 
     </dependencies> 
</plugin> 

Если я выполнить LiquiBase: generateChangeLog LiquiBase генерировать журнал с моей существующей базы данных ... Но если я пытался выполнить LiquiBase: диф я получаю ошибку:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.4.1:diff (default-cli) on project vacation-club-web: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:3.4.1:diff failed: A required class was missing while executing org.liquibase:liquibase-maven-plugin:3.4.1:diff: org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager 
[ERROR] ----------------------------------------------------- 
[ERROR] realm = plugin>org.liquibase:liquibase-maven-plugin:3.4.1 
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 
[ERROR] urls[0] = file:/C:/Users/lucas.araujo/.m2/repository/org/liquibase/liquibase-maven-plugin/3.4.1/liquibase-maven-plugin-3.4.1.jar 
[ERROR] urls[1] = file:/C:/Users/lucas.araujo/.m2/repository/org/liquibase/ext/liquibase-hibernate4/3.5/liquibase-hibernate4-3.5.jar 
[ERROR] urls[2] = file:/C:/Users/lucas.araujo/.m2/repository/org/hibernate/hibernate-core/4.3.1.Final/hibernate-core-4.3.1.Final.jar 
[ERROR] urls[3] = file:/C:/Users/lucas.araujo/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar 
[ERROR] urls[4] = file:/C:/Users/lucas.araujo/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar 
[ERROR] urls[5] = file:/C:/Users/lucas.araujo/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/jboss-transaction-api_1.2_spec-1.0.0.Final.jar 
[ERROR] urls[6] = file:/C:/Users/lucas.araujo/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar 
[ERROR] urls[7] = file:/C:/Users/lucas.araujo/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar 
[ERROR] urls[8] = file:/C:/Users/lucas.araujo/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.4.Final/hibernate-commons-annotations-4.0.4.Final.jar 
[ERROR] urls[9] = file:/C:/Users/lucas.araujo/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar 
[ERROR] urls[10] = file:/C:/Users/lucas.araujo/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar 
[ERROR] urls[11] = file:/C:/Users/lucas.araujo/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar 
[ERROR] urls[12] = file:/C:/Users/lucas.araujo/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar 
[ERROR] urls[13] = file:/C:/Users/lucas.araujo/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar 
[ERROR] urls[14] = file:/C:/Users/lucas.araujo/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.1.Final/hibernate-entitymanager-4.3.1.Final.jar 
[ERROR] urls[15] = file:/C:/Users/lucas.araujo/.m2/repository/org/hibernate/hibernate-envers/4.3.1.Final/hibernate-envers-4.3.1.Final.jar 
[ERROR] urls[16] = file:/C:/Users/lucas.araujo/.m2/repository/org/springframework/spring-beans/4.1.7.RELEASE/spring-beans-4.1.7.RELEASE.jar 
[ERROR] urls[17] = file:/C:/Users/lucas.araujo/.m2/repository/org/springframework/spring-core/4.1.7.RELEASE/spring-core-4.1.7.RELEASE.jar 
[ERROR] urls[18] = file:/C:/Users/lucas.araujo/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar 
[ERROR] urls[19] = file:/C:/Users/lucas.araujo/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar 
[ERROR] urls[20] = file:/C:/Users/lucas.araujo/.m2/repository/org/liquibase/liquibase-core/3.4.1/liquibase-core-3.4.1.jar 
[ERROR] Number of foreign imports: 1 
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]] 
[ERROR] 
[ERROR] -----------------------------------------------------: org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager 

Кто-то уже имел эту проблему?

ответ

5

Я решил эту проблему.

Решение - это одна зависимость, отсутствующая в моем файле pom.xml.

pom.xml

<!-- Liquibase --> 
    <dependency> 
     <groupId>org.liquibase</groupId> 
     <artifactId>liquibase-core</artifactId> 
     <version>3.4.1</version> 
    </dependency> 

    <dependency> 
     <groupId>org.liquibase</groupId> 
     <artifactId>liquibase-maven-plugin</artifactId> 
     <version>3.4.1</version> 
    </dependency> 

<plugin> 
    <groupId>org.liquibase</groupId> 
    <artifactId>liquibase-maven-plugin</artifactId> 
    <version>3.4.1</version> 
    <configuration> 
     <propertyFile>src/main/resources/liquibase.properties</propertyFile> 
    </configuration> 
     <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> 
     </dependencies> 
</plugin> 

 Смежные вопросы

  • Нет связанных вопросов^_^