ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "North Alex" <>
Subject RE: ANT Inside IBM WebSphere Application Developer
Date Thu, 10 Apr 2003 05:56:21 GMT

Sorry it took so long to respond ... I had a typical Monday ... only it
got extended :P

Anyway, here is a description of how we use ANT from within WSAD.  The
main reason we started to do this was to avoid the initial
installation/configuration on each workstation and also the upgrade
problems when we want to take a new version of a 3rd party library or,
as has happened, an upgrade of the IDE itself.  The only thing that has
to be done to each workstation is to make sure that 'java' and 'javadoc'
are in the path.

There are 3 "layers" to the scripts.  

1. build.xml
The script in the WSAD project.  

2. common-build.xml
Then we have a common build script that contains useful tasks for any
project, such as building JavaDocs plus it contains the calls for
executing targets in an external version of ANT.
This script exists in one place (under source control for us) and is
used by many projects.

3. common-external-build.xml
Finally we have the script that does the actual work in the ANT version
we want.

1. build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="CommonDAO" default="Compile">

	<!-- basic component info -->
	<property name = "" 	 	value =
	<property name = "component.version" 	value =
	<property name = "root.dir" 		 	value =
	<property name = "html.title"		 	value = "Common
DAO ${component.version}"/>

	<!-- physical locations -->
	<property name = "classes.dir" 	 	value =
	<property name = "source.dir" 	 	value =
	<property name = "test.source.dir" 	 	value =
	<property name = "javadoc.dir" 		value =

	<!-- ant related -->
	<property name = "script.root.dir"	 	value =
	<property name = ""	 	value =

	<!-- compile all source for this project -->
	<target name="Compile" depends="clean">
		<projectBuild ProjectName="${}"
			DebugCompilation="true" BuildType="full"/>

	<!-- Build the JavaDoc API docs -->
	<target name="JavaDoc">
		<ant antfile="${}" target="javadoc"/>


2. common-build.xml:
<?xml version="1.0"?>
<project name="Common ANT Script" default="javadoc">
	<!-- ant related -->
	<property name = "ext.ant.home" 	value =
	<property name = "ext.ant"	    	value =
	<property name = "script.root.dir"	value =
	<property name = "ext.ant.params" 	value = "-buildfile

	<!-- Build the JavaDocs -->
	<target name="javadoc">
		<mkdir dir="${javadoc.dir}"/>
		<javadoc destdir="${javadoc.dir}" public="true"
			notree="false" nonavbar="false" noindex="false"
			splitindex="true" author="true" version="true"
			nodeprecatedlist="false" nodeprecated="false"

	<target name="checkstyle">
		<exec executable="${ext.ant}" failonerror="true">
			<arg line="${ext.ant.params}"/>
			<arg line="checkstyle"/>
			<arg line='-Dsource.dir="${source.dir}"'/>
			<arg line='-Dreport.dir="${report.dir}"'/>


3. common-external-build.xml

<?xml version="1.0"?>
<project name="Common External ANT Script" default="depend">

	<!-- 3rd party lib location -->
	<property name = "3rdparty.dir"	value =

	<!-- task(s) related -->
    <!-- CheckStyle -->
	<property name = "" value =
	<property name = ""     value =
	<property name = "checkstyle.xsl"        value =
      <property name = "checkstyle.config"     value =

	<target name="init">
		<mkdir dir="${report.dir}"/>

	<!-- Checkstyle -->
	<target name="checkstyle" depends="init">
		<mkdir dir="${}"/>
		<taskdef name="checkstyle"
		<checkstyle config="${checkstyle.config}"
			<fileset dir="${source.dir}"
			<formatter type="xml"
		<style basedir="${}"

... and that should be it.  A very flexible system that allows us to
provide common tasks for use, update tasks, ANT version, and even use
different ANT versions for different tasks if needed.

Feel free to bug me if anything is not clear.

<= Alex =>

View raw message