blob: b49cb5956e85a2ae5f72994c9c5a73b1506a5bf7 [file] [log] [blame]
<?xml version="1.0"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project name="spring-hibernate" default="dist">
<property name="root.base.dir" value="../.."/>
<!-- "extend" parent build definition -->
<import file="../../build.xml"/>
<property name="module.name" value="spring-hibernate"/>
<property name="module.base.dir" value="${root.base.dir}/samples/spring-hibernate"/>
<property name="dist.jar.name" value="${project.name}-${module.name}.jar"/>
<property name="dist.jar" value="${dist.dir}/${dist.jar.name}"/>
<!-- Module properties -->
<property name="dist.war.name" value="${project.name}-${module.name}.war"/>
<property name="dist.war" value="${root.base.dir}/build/${dist.war.name}"/>
<property name="dist.dir" value="${build.dir}/dist"/>
<!-- Deployment properties for development -->
<property name="deploy.dir" value="${env.CATALINA_HOME}/webapps"/>
<path id="compile.path">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<!-- ===================================================================
- clean - clean all build remnants from this submodule
- ==================================================================== -->
<target name="clean" depends="clean-deploy-dir" description="Cleans the spring-hibernate sample application build">
<echo message="cleaning ${module.name} module"/>
<delete file="${dist.war}"/>
<delete dir="${build.dir}"/>
</target>
<target name="clean-deploy-dir" description="Removes the deployed war directory">
<echo message="cleaning ${dist.war.name} module from ${deploy.dir}"/>
<delete file="${deploy.dir}/${dist.war.name}"/>
<delete dir="${deploy.dir}/${project.name}-${module.name}"/>
</target>
<!-- ===================================================================
- compile - compile Java source files
- =================================================================== -->
<target name="compile" description="Compiles the sample spring-hibernate app classes">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${classes.dir}/META-INF"/>
<javac destdir="${classes.dir}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
failonerror="true"
classpathref="all.libs">
<src path="${src.dir}"/>
<classpath location="${root.dist.dir}/jsecurity.jar"/>
</javac>
</target>
<target name="jar" depends="compile" description="Creates a jar of the spring-hibernate sample app classes">
<mkdir dir="${dist.dir}"/>
<jar jarfile="${dist.dir}/${dist.jar.name}">
<fileset dir="${classes.dir}">
<include name="**/*.class"/>
</fileset>
<manifest>
<attribute name="Implementation-Title" value="${project.name}-${module.name}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="${project.name}-Version" value="${version}"/>
</manifest>
</jar>
</target>
<!-- ===================================================================
- dist - create distribution war (which will be used for deployment)
- =================================================================== -->
<target name="dist" depends="compile,jar" description="Creates the quickstart .war">
<war warfile="${dist.war}" webxml="WEB-INF/web.xml">
<lib dir="${dist.dir}" includes="*.jar"/>
<lib dir="${root.dist.dir}" includes="jsecurity.jar"/>
<lib dir="${lib.dir}/samples">
<include name="jstl.jar"/>
<include name="standard.jar"/>
<include name="log4j.jar"/>
<include name="commons-*.jar"/>
<include name="ehcache.jar"/>
<include name="backport-util-concurrent.jar"/>
<include name="hsqldb.jar"/>
<include name="spring.jar"/>
</lib>
<!-- Hibernate libs: -->
<lib dir="${lib.dir}/samples">
<include name="hibernate.jar"/>
<include name="antlr.jar"/>
<include name="asm-attrs.jar"/>
<include name="asm.jar"/>
<include name="cglib.jar"/>
<include name="geronimo-jta_1.0.1B_spec.jar"/>
<include name="dom4j.jar"/>
<include name="commons-collections.jar"/>
</lib>
<fileset dir="${module.base.dir}" includes="**" excludes="**/web.xml, **/build.xml"/>
<!-- <lib dir="${dist.dir}" includes="*.jar"/> -->
</war>
</target>
<target name="quick-deploy" description="Blindly deploys the spring-hibernate sample app .war to Tomcat">
<echo>Deploying application to Tomcat...</echo>
<unzip src="${dist.war}" dest="${env.CATALINA_HOME}/webapps/${project.name}-${module.name}"/>
<touch file="${env.CATALINA_HOME}/webapps/${project.name}-${module.name}/WEB-INF/web.xml"/>
</target>
<target name="deploy" depends="dist,quick-deploy"
description="Creates and deploys the spring-hibernate sample app .war to Tomcat"/>
</project>