JdbcMapper/samples/netui-jsf/build.xml

145 lines
5.9 KiB
XML

<?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.
$Header:$
-->
<!--
An Ant build file for compiling the netui-jsf Beehive sample web application.
-->
<project name="Beehive/Samples/NetUI-JSF-Samples" default="usage" basedir=".">
<property environment="os"/>
<property file="build.properties"/>
<import file="${beehive.home}/beehive-imports.xml"/>
<property name="build.dir" location="build"/>
<property name="web.dir" location="web"/>
<property name="src.dir" location="src"/>
<!-- Define the classpath used to build the webapp -->
<path id="webapp.classpath">
<path refid="velocity.dependency.path"/>
<path refid="netui-compiler.dependency.path"/>
<pathelement location="${servlet-api.jar}"/>
<pathelement location="${jsp-api.jar}"/>
<pathelement location="${build.dir}/WEB-INF/classes"/>
<fileset dir="${build.dir}/WEB-INF/lib" includes="*.jar"/>
</path>
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/WEB-INF/classes"/>
<deploy-netui webappDir="${build.dir}"/>
<copy todir="${build.dir}/" includeEmptyDirs="false">
<fileset dir="${web.dir}"/>
</copy>
<copy todir="${build.dir}/WEB-INF/classes">
<fileset dir="${src.dir}/">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<target name="build-internal">
<taskdef name="apt"
classname="org.apache.beehive.controls.runtime.generator.AptTask"
classpathref="webapp.classpath"
onerror="fail"/>
<apt srcdir="${src.dir}"
destdir="${build.dir}/WEB-INF/classes"
gendir="${build.dir}/WEB-INF/.tmpbeansrc"
classpathref="webapp.classpath"
srcExtensions="*.java"
debug="true"
processorOptions="web.content.root=${web.dir}"
nocompile="false"/>
</target>
<target name="init-myfaces" depends="init"
description="Build the netui-jsf webapp, for use with MyFaces">
<property name="myfaces.jar" value="${myfaces.dir}/myfaces.jar"/>
<available property="myfaces.jar.available" file="${myfaces.jar}" type="file"/>
<fail unless="myfaces.jar.available" message="Can't find the MyFaces JAR ${myfaces.jar}"/>
<copy file="${myfaces.jar}" todir="${build.dir}/WEB-INF/lib"/>
<copy file="${web.dir}/WEB-INF/web.xml.myfaces" tofile="${build.dir}/WEB-INF/web.xml"/>
</target>
<target name="init-jsf-ri"
depends="init"
description="Build the netui-jsf webapp, for use with the JSF Reference Implementation">
<property name="jsf-ri-api.jar" value="${jsf-ri.dir}/jsf-api.jar"/>
<available property="jsf-ri-api.jar.available" file="${jsf-ri-api.jar}" type="file"/>
<fail unless="jsf-ri-api.jar.available" message="Can't find the JSF API JAR ${jsf-ri-api.jar}"/>
<property name="jsf-ri-impl.jar" value="${jsf-ri.dir}/jsf-impl.jar"/>
<available property="jsf-ri-impl.jar.available" file="${jsf-ri-impl.jar}" type="file"/>
<fail unless="jsf-ri-impl.jar.available" message="Can't find the JSF implementation JAR ${jsf-ri-impl.jar}"/>
<copy file="${jsf-ri-api.jar}" todir="${build.dir}/WEB-INF/lib"/>
<copy file="${jsf-ri-impl.jar}" todir="${build.dir}/WEB-INF/lib"/>
<copy file="${web.dir}/WEB-INF/web.xml.jsf-ri" tofile="${build.dir}/WEB-INF/web.xml"/>
</target>
<target name="build-myfaces" depends="init-myfaces,build-internal"
description="Build the netui-jsf webapp, for use with MyFaces"/>
<target name="build-jsf-ri" depends="init-jsf-ri,build-internal"
description="Build the netui-jsf webapp, for use with the JSF Reference Implementation"/>
<target name="build" depends="build-myfaces"
description="Build the webapp with MyFaces"/>
<target name="clean" description="Clean the netui-jsf webapp">
<delete dir="${build.dir}"/>
</target>
<target name="war" description="Build a compressed WAR file that can be deployed to an application container">
<property name="archive.dir" value="${build.dir}/.."/>
<!-- this does *not* exclude source from the archive -->
<war destfile="${archive.dir}/${context.path}.war" webxml="${build.dir}/WEB-INF/web.xml">
<fileset dir="${build.dir}">
<exclude name="WEB-INF/web.xml"/>
</fileset>
</war>
</target>
<target name="usage" description="Print usage information for this build file">
<echo>
Welcome to the Beehive netui-jsf webapp!
ant clean -- cleans the netui-jsf webapp
ant build-myfaces -- builds the netui-jsf webapp against MyFaces (v1.0.9 or later)
ant build-jsf-ri -- builds the netui-jsf webapp against the JSF Reference Implementation (v1.1.01)
ant war -- creates a .war archive to deploy; build-myfaces or build-jsf-ri must be called first
</echo>
<java fork="no" classname="org.apache.tools.ant.Main">
<arg line="-f ${ant.file} -projecthelp"/>
</java>
</target>
</project>