Before running integration tests I need to setup database. This include generating SQL-scheme (based on JPA-annotations), save it to file and copy it with other resources to directory which later will be used for creating war file (which will be deployed to Jetty).
So, I use following hibernate3-maven-plugin configuration for generating SQL-scheme: http://pastebin.ubuntu.com/606229/
To copy resulting hsql-scheme.sql from src/env/test/WEB-INF/classes to target/ where it will be packaged to WAR-file I use following:
http://pastebin.ubuntu.com/606230/
But when I run mvn verify -P test (yes, all these code inside separate profile) I’ve got: http://pastebin.ubuntu.com/606231/
As you can see hibernate3:hbm2ddl does not generate any SQL-scheme and resulting file is empty (in other case we will see it on console also). And this is a problem.
The root of problem (as I understand) is because hibernate3:hbm2ddl invokes the execution of the lifecycle phase process-resources prior to executing itself.
Thanks in advance!
This question helped me to fix schema’ creation:
call
hibernate3:hbm2ddlatprepare-packagephase instead ofgenerate-resourcesput result of
hibernate3:hbm2ddldirectly totarget/${build.finalName}/WEB-INF/classesSo, now I still have
hibernate3:hbm2ddl invokes the execution of the lifecycle phase process-resources prior to executing itselfwarning, but filetarget/${build.finalName}/WEB-INF/classes/hsql-scheme.sqlnot empty as before.