alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<?xml version="1.0"?>
<project name="project" default="default">	
	<description>
            Webapp Builder
    </description>

	<!-- ================================= 
          target: default              
         ================================= -->
	<target name="init">
    	<property name="proj.dir" value="${basedir}/.."/>
		<!-- 
		On windows be cautious about long file names for ${build.dir}
		These long path problems were resolved in JRE 1.5.0_08
		-->
    	<property name="build.dir" value="${proj.dir}/build"/>
    	<property name="templates.dir" value="${proj.dir}/templates"/>
		<property name="webapp.name" value="bridge"/>
		<!-- 
		the servletbridge feature can be found in the eclipse depot 
		Repository Path: /cvsroot/eclipse
		Module: equinox-incubator/org.eclipse.equinox.servletbridge.feature
		--> 
		<property name="features" value="org.eclipse.equinox.servletbridge.feature"/>
		<available file="${proj.dir}/servletbridge.jar" property="servletbridge.jar-present"/>
		<!--
		If you are using this script in a head-less build define the following properties:
		"ignore.pdeExportFeatures" (available only in the IDE - do the feature export with PDE Build)
		"ignore.servletbridge.jar" (if you're compiling or extracting the jar yourself)
		-->
	</target>

	<!-- ================================= 
          target: prepare              
         ================================= -->	
	<target name="prepare" depends="init">
		<delete dir="${build.dir}/${webapp.name}"/>
		<mkdir dir="${build.dir}/${webapp.name}/WEB-INF/lib"/>
	</target>
	<!-- ================================= 
          target: default              
         ================================= -->
	<target name="default" depends="copyResources, servletbridge.jar, pdeExportFeatures"/>
	
	<!-- ================================= 
          target: copyResources              
         ================================= -->	
	<target name="copyResources" depends="prepare">
		<copy todir="${build.dir}/${webapp.name}">
			<fileset dir="${templates.dir}"/>
		</copy>
	</target>
	
	<!-- ================================= 
          target: servletbridge.jar              
         ================================= -->	
	<target name="servletbridge.jar" depends="prepare" unless="ignore.servletbridge.jar">
		<antcall target="jar-servletbridge.jar" />
		<antcall target="copy-servletbridge.jar"/>
	</target>

	<!-- ================================= 
          target: copy-servletbridge.jar              
         ================================= -->	
	<target name="copy-servletbridge.jar" if="servletbridge.jar-present">
		<copy todir="${build.dir}/${webapp.name}/WEB-INF/lib">
			<fileset file="${proj.dir}/servletbridge.jar"/>
		</copy>
	</target>
	
	<!-- ================================= 
          target: jar-servletbridge.jar              
         ================================= -->	
	<target name="jar-servletbridge.jar" unless="servletbridge.jar-present">
		<jar destfile="${build.dir}/${webapp.name}/WEB-INF/lib/servletbridge.jar">
			<fileset dir="${proj.dir}/bin">
				<include name="**/*.class"/>
			</fileset>
		</jar>
	</target>
	
	<!-- ================================= 
          target: pdeExportFeatures              
         ================================= -->		
	<target name="pdeExportFeatures" depends="prepare" unless="ignore.pdeExportFeatures">
		<!-- 
		Features get built asynchronously but this approach is sometimes convenient.
		So that the pde.exportFeatures task is available in the IDE select 
		"Run in the same JRE as the workspace" from the JRE tab from "Run Ant.."
		--> 
		<pde.exportFeatures
			features="${features}"
			destination="${build.dir}/${webapp.name}/WEB-INF/eclipse"
			exportType="directory" 
			useJARFormat="false"
			exportSource="false"
		/>
	</target>
</project>

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.