Archive for May, 2008
Use the following targets to auto generate hibernate mapping files from database and pojos from .hbm.xml files.
<taskdef name=”hbm2java”
classname=”net.sf.hibernate.tool.hbm2java.Hbm2JavaTask”>
<classpath refid=”hbm2java.class.path” />
</taskdef>
<taskdef name=”middlegen” classname=”middlegen.MiddlegenTask”>
<classpath refid=”middlegen.class.path” />
</taskdef>
<target name=”hbm2java” description=”Generate Java Pojos from the Hibernate mapping files”>
<hbm2java output=”${source.generated}”
config=”hibernate.cfg.xml”>
<fileset dir=”${hibernate.source}”>
<include name=”**/*.hbm.xml” />
</fileset>
</hbm2java>
</target>
<target name=”middlegen” description=”Generate Hibernate mapping files”>
<middlegen appname=”Hibernate-Spring” prefsdir=”${middlegen.temp}”
gui=”false” databaseurl=”${jdbc.url}” driver=”${jdbc.driver}”
username=”${database.username}” password=”${database.password}”
schema=”${database.schema}” catalog=”${database.catalog}”>
<!– Optionally declare table elements –>
<!– Optionally declare [...]
Filed under: Technical | 2 Comments
Tags: Auto Generate, files, hbm2java, hibernate, mapping, middlegen, pojos
start stop tomcat with ant
Here is a simple ant target to start/stop your instance of tomcat running
<target name=”start-tomcat”>
<if>
<not>
<http url=”http://localhost:8080″ />
</not>
<then>
<java jar=”${tomcat.home}/bin/bootstrap.jar” fork=”true”>
<jvmarg value=”-Dcatalina.home=${tomcat.home}” />
</java>
<echo message=”Server Started”></echo>
</then>
<else>
<echo message=”Tomcat Instance Already Running”></echo>
</else>
</if>
</target>
<target name=”stop-tomcat”>
<if>
<http url=”http://localhost:8080″ />
<then>
<java jar=”${tomcat.home}/bin/bootstrap.jar” fork=”true”>
<jvmarg value=”-Dcatalina.home=${tomcat.home}” />
<arg line=”stop” />
</java>
<echo message=”Server Terminated”></echo>
</then>
<else>
<echo message=”No Tomcat Instance Running”></echo>
</else>
</if>
</target>
These targets would first check to see if any instance of tomcat is running or [...]
Filed under: Technical | 1 Comment
Tags: ant, start, stop, tomcat
Search
-
You are currently browsing the Sanchit Srivastava weblog archives for the month May, 2008.