-->
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.  [ 1 post ] 
Author Message
 Post subject: hbm.files and pojo(.java files) generation using build.xml
PostPosted: Wed Apr 04, 2012 7:48 am 
Newbie

Joined: Wed Apr 04, 2012 3:11 am
Posts: 1
how to generate .hbm.xml files and .java files using build.xml

it gives me error like
build failed

build.xml:30: java.lang.NoClassDefFoundError: org/hibernate/engine/Mapping

my build.xml file is
-------------------------------------------------------------------

<?xml version="1.0"?>

<project name="lms" default="" basedir=".">

<property name="resources.dir" value="${basedir}/src/main/resources" />
<property name="java.dir" value="${basedir}/src/main/java" />
<property name="java.domain.core.dir" value="${java.dir}/com/abm/lms/domain/core/demo" />
<property name="java.generator.dir" value="${java.dir}/com/ao2/smart/generator" />
<property name="classes.dir" value="${basedir}/WebContent/WEB-INF/classes" />
<property name="lib.dir" value="${basedir}/WebContent/WEB-INF/lib" />
<property name="tab" value="&#x0009;" />
<property name="http.proxyHost" value="proxy.RAVI-LENOVO"/>
<property name="http.proxyPort" value="8443"/>

<path id="toolslib">
<path location="${lib.dir}/hibernate-core-4.1.0.Final.jar" />

<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>

<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />

<target name="CodeGen.GenerateDomainObjects" depends="CodeGen.AdjustCollections,CodeGen.AddOrphanRemoval,CodeGen.AddSerialVersion, CodeGen.ChildAddMethodInjector">
</target>

<!-- Generate hbm.xml and java files -->
<target name="CodeGen.RunHibernateTool" description="generate hibernate classes n java classes">
<hibernatetool destdir="${java.dir}">

<jdbcconfiguration configurationfile="${resources.dir}/hibernate.cfg.xml" packagename="com.abm.lms.domain.core.demo" revengfile="${basedir}\hibernate.reveng.xml" detectmanytomany="true" />
<hbm2hbmxml />
<hbm2java jdk5="true" ejb3="true" />

</hibernatetool>

</target>


<!-- Searches and replaces the two regular expressions -->
<target name="CodeGen.AdjustCollections">

<replaceregexp byline="true">
<regexp pattern="import java.util.HashSet;" />
<substitution expression="import java.util.ArrayList;" />
<fileset dir="${java.domain.core.dir}" includes="*.java" />
</replaceregexp>

<replaceregexp byline="true">
<regexp pattern="import java.util.Set;" />
<substitution expression="import java.util.List;" />
<fileset dir="${java.domain.core.dir}" includes="*.java" />
</replaceregexp>

<replaceregexp byline="true">
<regexp pattern="new HashSet" />
<substitution expression="new ArrayList" />
<fileset dir="${java.domain.core.dir}" includes="*.java" />
</replaceregexp>

<replaceregexp flags="g">
<regexp pattern="Set&lt;(\w*)&gt;" />
<substitution expression="List&lt;\1&gt;" />
<fileset dir="${java.domain.core.dir}" includes="*.java" />
</replaceregexp>

</target>

<target name="CodeGen.AddOrphanRemoval">
<replaceregexp byline="true">
<regexp pattern="@OneTo(.*)\)" />
<substitution expression="${tab}@OneTo\1, cascade = javax.persistence.CascadeType.ALL, orphanRemoval = true)" />
<fileset dir="${java.domain.core.dir}" includes="*.java" />
</replaceregexp>
</target>

<target name="CodeGen.AddSerialVersion">
<replaceregexp>
<regexp pattern="implements java\.io\.Serializable\s*\{" />
<substitution expression="implements java\.io\.Serializable${line.separator}{${line.separator}${tab}private static final long serialVersionUID = 1L;" />
<fileset dir="${java.domain.core.dir}" includes="*.java" />
</replaceregexp>
</target>

<target name="CodeGen.ChildAddMethodInjector">

<java classname="com.ao2.smart.generator.ChildAddMethodInjector" fork="yes">
<sysproperty key="http.proxyHost" value="${http.proxyHost}" />
<sysproperty key="http.proxyPort" value="${http.proxyPort}" />
<sysproperty key="xslt.file" value="${java.generator.dir}/ChildAddMethodInjector.xsl" />
<sysproperty key="xml.files.dir" value="${java.domain.core.dir}" />
<classpath>
<path location="${classes.dir}"/>
<path refid="toolslib"/>
</classpath>
</java>

</target>

<target name="CodeGen.FieldLabelsProperties">

<java classname="com.ao2.smart.generator.FieldLabelsGenerator" fork="yes">
<sysproperty key="http.proxyHost" value="${http.proxyHost}" />
<sysproperty key="http.proxyPort" value="${http.proxyPort}" />
<sysproperty key="xslt.file" value="${java.generator.dir}/FieldLabelsGenerator.xsl" />
<sysproperty key="xml.files.dir" value="${java.domain.core.dir}" />
<sysproperty key="output.file" value="${resources.dir}/field-labels.properties" />
<classpath>
<path location="${classes.dir}"/>
<path refid="toolslib"/>
</classpath>
</java>

</target>

</project>
-----------------------------------------

reply soon
thanks


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

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.