【发布时间】:2015-02-03 12:30:49
【问题描述】:
用于生成 DDL 创建/删除脚本的 hibernate3-maven-plugin 似乎与 Hibernate 4.3 和更新版本(使用 JPA 2.1)不再兼容。
我使用这个插件配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>
<executions>
<execution>
<id>generate-sql-schema</id>
<phase>process-sources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
<configuration>
<hibernatetool>
<jpaconfiguration persistenceunit="${persistenceUnitName}" />
<hbm2ddl update="true" create="true" export="false"
outputfilename="src/main/sql/schema.sql" format="true"
console="true" />
</hibernatetool>
</configuration>
</execution>
</executions>
</plugin>
但我收到以下错误:
[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (generate-sql-schema) on project my-project: There was an error creating the AntRun task.
An Ant BuildException has occured: java.lang.NoClassDefFoundError: org/hibernate/util/ReflectHelper: org.hibernate.util.ReflectHelper -> [Help 1]
此类已迁移到新包:org.hibernate.internal.util.ReflectHelper
但是我发现没有明确的方法可以在 MAVEN 构建时继续生成 DDL 创建脚本。
没有hibernate4-maven-plugin,或任何其他官方方式。
那又怎样?这不是应该支持的主要功能吗?怎么办?
【问题讨论】:
标签: maven ddl hibernate-4.x jpa-2.1 hibernate3-maven-plugin