-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Plain vanilla example built with maven.
PostPosted: Tue Feb 24, 2004 6:22 pm 
Newbie

Joined: Sun Feb 22, 2004 9:53 am
Posts: 2
Location: Oslo
I've tried to setup maven with ant scriptnig in maven.xml for a few days now. I have made it very simple and i have tried to export .ddl files using schemaexport.

I've ran into all different kind of problems. Tried to build it with 2.0.x and 2.1.x with the appropriate dependencies but now im just not in the mood for plundering anymore..
Maven returns with BUILD SUCCESSFULL but no .ddl files whatsover is made.

So if someone could paste the neccessary deps or a working maven.xml file i would really appreciate it.

Also a plain vanilla maven/schemaexport/hibernate example would be strongly appreciated.

My maven.xml looks like this btw. Think its not thats what's messy but the dependencies or maybe some maven specific "issues". Again, a fully working vanilla example would be really sweet.
[code]
<project
xmlns:ant="jelly:ant"
xmlns:core="jelly:core"
xmlns:util="jelly:util">

<goal name="generate-schema">
<util:tokenize var="dbTypes" delim=",">
postgresql
</util:tokenize>

<core:forEach items="${dbTypes}" var="dbType">
<ant:echo>Creating schemas for ${dbType}</ant:echo>
<ant:java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport">
<ant:arg value="--quiet=no"/>
<ant:arg value="--text=yes"/>
<ant:arg value="--format=yes"/>
<ant:arg value="--delimiter=;"/>
<ant:arg value="--output=src/main/resources/schemas/${dbType}.ddl"/>
<ant:arg value="--config=/${dbType}.cfg.xml"/>

<ant:classpath>
<ant:path refid="maven.dependency.classpath"/>
<ant:pathelement location="src/main/resources/schemas"/>
<ant:pathelement location="src/main/java"/>
<ant:pathelement location="${maven.build.dest}"/>
</ant:classpath>
</ant:java>
</core:forEach>
</goal>

</project>[code][/code]


Top
 Profile  
 
 Post subject: maven example
PostPosted: Wed May 26, 2004 2:16 pm 
Newbie

Joined: Tue May 25, 2004 9:56 am
Posts: 19
You must be able to connect to your database server. I used hsqldb, so you can run the server like this:
Code:
java -cp hsqldb-1.7.1.jar org.hsqldb.Server


in maven.xml:
Code:
  <postGoal name="java:compile">
    <taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
        <classpath>
            <path refid="maven.dependency.classpath"/>
            <pathelement location="${maven.build.dest}"/><!-- our classes must be on the classpath -->
        </classpath>
    </taskdef>
    <mkdir dir="${maven.build.dir}/sql"/>
    <schemaexport quiet="no" text="true" drop="no" delimiter=";"
      properties="${maven.src.dir}/com/foo/bar/myapp/hibernate.properties"
      output="${maven.build.dir}/sql/schema-export.sql">
      <fileset dir="${maven.xdoclet.hibernatedoclet.destDir}" includes="**/*.hbm.xml"/>
    </schemaexport>
  </postGoal>


Make sure you have a <dependency> for dom4j in project.xml because schemaexport uses it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.