blob: 84bb081393dec7d3eed299d5fbb6f9443c649abe [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="samples-spring" default="package">
<property name="root.base.dir" value="../.."/>
<property name="module.name" value="samples-spring"/>
<import file="${root.base.dir}/common.ant.xml"/>
<property name="dist.jarName" value="${project.name}-${module.name}-${version}"/>
<property name="dist.jar" value="${dist.dir}/samples/${dist.jarName}.jar"/>
<property name="dist.warName" value="${project.name}-${module.name}-${version}"/>
<property name="dist.war" value="${dist.dir}/samples/${dist.warName}.war"/>
<path id="compile.path">
<fileset dir="${lib.dir}/samples">
<include name="*.jar"/>
</fileset>
<fileset dir="${dist.dir}/modules">
<include name="${project.name}-core-${version}.jar"/>
<include name="${project.name}-web-${version}.jar"/>
</fileset>
</path>
<!-- ===================================================================
clean - clean all build remnants from this submodule
==================================================================== -->
<target name="clean-deploy-dir" description="Removes the deployed war directory">
<echo message="cleaning ${dist.warName} module from ${deploy.dir}"/>
<delete file="${deploy.dir}/${dist.warName}.war"/>
<delete dir="${deploy.dir}/${dist.warName}"/>
</target>
<target name="clean" depends="clean-deploy-dir" description="Cleans the Spring sample webapp build">
<echo message="cleaning ${module.name} module"/>
<delete file="${dist.jar}"/>
<delete file="${dist.war}"/>
<delete dir="${build.dir}"/>
</target>
<target name="grabLogo" description="Ensures the Apache Ki logo is available to the jar task for inclusion in the jar">
<copy todir="${classes.dir}">
<fileset dir="webroot">
<include name="logo.png"/>
</fileset>
</copy>
</target>
<target name="compile" depends="compile.src"/> <!-- no test classes, no need to depend on compile.test -->
<target name="jar" depends="compile,grabLogo,jar.jdk15,jar.retroweaver"
description="Creates a .jar of the Spring sample app classes"/>
<target name="war">
<property name="webstart.lib.dir" value="${build.dir}/webstart"/>
<mkdir dir="${webstart.lib.dir}"/>
<copy todir="${webstart.lib.dir}" preservelastmodified="true" flatten="true">
<fileset dir="${dist.dir}" includes="${dist.jarName}.jar"/>
<fileset dir="${dist.dir}" includes="${project.name}-${version}.jar"/>
<fileset dir="${lib.dir}/samples" includes="spring-*.jar" excludes="spring-webmvc-*.jar"/>
<fileset dir="${lib.dir}/samples" includes="commons-*.jar"/>
</copy>
<signjar keystore="${etc.dir}/jsecurity-sample.jks"
alias="jsecurity"
keypass="jsecurity"
storepass="jsecurity">
<fileset dir="${webstart.lib.dir}" includes="*.jar"/>
</signjar>
<war warfile="${dist.war}" webxml="src/main/webapp/WEB-INF/web.xml">
<lib dir="${lib.dir}/samples">
<exclude name="servlet-api-*.jar"/>
</lib>
<lib dir="${lib.dir}/samples" includes="*.jar" excludes="servlet-api-*.jar"/>
<lib dir="${root.dist.dir}" includes="${project.name}-${version}.jar"/>
<webinf dir="${basedir}" includes="resources/**"/>
<fileset dir="webroot" includes="**" excludes="**/web.xml"/>
<lib dir="${dist.dir}" includes="*.jar"/>
<!-- Jar for webstart application -->
<fileset dir="${webstart.lib.dir}" includes="*.jar"/>
</war>
</target>
<target name="package" depends="jar,war"/>
<target name="quick-deploy" description="Blindly deploys the sample Spring .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="package,quick-deploy"
description="Creates and deploys the sample Spring .war to Tomcat"/>
</project>