This is a very special question, I hope that somebody here already worked in a similar project setup.
I am working with Netbeans and started a maven web project based upon the maven HS 4.x tutorial on http://www.hibernatespatial.org/tutorial-hs4.html
This compiles fine using maven.
Next I want to use the maven hibernate3 plugin from MOJO (http://mojo.codehaus.org/hibernate3-maven-plugin/index.html), so I can create SQL Scripts and the database schema out of my java entitiy classes. So the workflow should be
- code java entitiy classes with spatial (postgis) fields
- compile
- create DDL out of entity classes
- create/update database schema with DDL
- run app
The problem is, when I run
mvn hibernate3:hbm2ddl
The plugin does not search for hibernate spatial in the remote repo on www.hibernatespatial.org like the compile plugin does, but searches for it in the central repo. Due to the fact, that the hibernate-spatial.jar does not exist there, DDL creation fails. This is what the maven output looks like:
[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl ... Plugin org.codehaus.mojo:hibernate3-maven-plugin:2.2 or one of its dependencies could not be resolved: Could not find artifact org.hibernate:hibernate-spatial:jar:4.0-M1 in central (http://repo.maven.apache.org/maven2) -> [Help 1]
...
Caused by: ... Could not find artifact org.hibernate:hibernate-spatial:jar:4.0-M1 in central (http://repo.maven.apache.org/maven2)
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
As I already mentioned, maven compile goal works and resolves hibernate-spatial correctly.
Is there an alternative way to create database schema out of java entity classes without the maven hibernate plugin?