我已经更新到更新版本的hibernate3-maven-plugin.尝试使用下面提到的插件时出现以下错误.
非常感谢解决这个问题的任何指示.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>
<executions>
<execution>
<id>create sql schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
<configuration>
<componentProperties>
<persistenceunit>${app.module}</persistenceunit>
<drop>false</drop>
<create>true</create>
<outputfilename>${app.sql}-create.sql</outputfilename>
<skip>${db.schema.gen.skip}</skip>
</componentProperties>
</configuration>
</execution>
<execution>
<id>drop sql schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
<configuration>
<componentProperties>
<persistenceunit>${app.module}</persistenceunit>
<drop>true</drop>
<create>false</create>
<outputfilename>${app.sql}-drop.sql</outputfilename>
<skip>${db.schema.gen.skip}</skip>
</componentProperties>
</configuration>
</execution>
</executions>
</plugin>
[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (create sql schema) on project sample: There was an error creating the AntRun task. NullPointerException -> [Help 1]org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (create sql schema) on project framework: There was an error creating the AntRun task.
Run Code Online (Sandbox Code Playgroud)
Kuh*_*pid 12
配置方式改为直接使用ant hibernate工具插件.所以配置与ant插件完全相同,不需要额外的taskDef,例如jpaconfiguration.有关详细信息,请参阅hibernate ant工具参考文档:http://docs.jboss.org/tools/3.3.0.Final/en/hibernatetools/html_single/index.html#d0e4651.
对于具有jpa配置的hbm2ddl,您可以使用以下内容:
<plugin>
<!-- run "mvn hibernate3:hbm2ddl" to generate a schema -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<hibernatetool>
<jpaconfiguration persistenceunit="unitname" />
<hbm2ddl export="false" create="true"
update="true" format="true" outputfilename="schemaDiff.ddl" />
</hibernatetool>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
失败时,会有"target/antrun/build-main.xml"文件配置hibernate工具.对于上面的示例,这看起来如下:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="maven-antrun-" default="main" >
<target name="main">
<taskdef classname="org.hibernate.tool.ant.EnversHibernateToolTask" name="hibernatetool"/>
<mkdir dir="/home/xxx/workspace/projectname/target/sql/hibernate3"/>
<hibernatetool destdir="/home/xxx/workspace/projectname/target/sql/hibernate3">
<jpaconfiguration persistenceunit="schemaDiff"/>
<hbm2ddl update="true" export="false" outputfilename="schemaDiff.ddl" format=
"true" create="true"/>
</hibernatetool>
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
23673 次 |
最近记录: |