在运行集成测试之前,我需要设置数据库。这包括生成SQL-scheme (基于JPA-annotations),将其保存到文件中,并与其他资源一起复制到目录中,该目录稍后将用于创建war文件(将部署到Jetty)。
因此,我使用以下hibernate3-maven-plugin配置来生成SQL方案:http://pastebin.ubuntu.com/606229/
要将生成的hsql-scheme.sql从src/env/test/WEB-INF/classes复制到target/,并将其打包为WAR文件,我使用以下命令:http://pastebin.ubuntu.com/606230/
但是当我运行mvn verify -P test (是的,所有这些代码都在单独的配置文件中)时,我得到了:http://pastebin.ubuntu.com/606231/
正如您所看到的,hibernate3:hbm2ddl不会生成任何SQL方案,并且生成的文件为空(在其他情况下,我们也会在控制台上看到它)。这是一个问题。
问题的根源(据我所知)是因为hibernate3:hbm2ddl invokes the execution of the lifecycle phase process-resources prior to executing itself。
提前感谢!
发布于 2011-05-14 19:22:47
This question帮助我修复了模式的创建:
target/${build.finalName}/WEB-INF/classes阶段调用prepare-package,而不是直接向generate-resources
hibernate3:hbm2ddl结果所以,现在我仍然有hibernate3:hbm2ddl invokes the execution of the lifecycle phase process-resources prior to executing itself警告,但是文件target/${build.finalName}/WEB-INF/classes/hsql-scheme.sql不像以前那样是空的。
https://stackoverflow.com/questions/5968512
复制相似问题