Generating Ant build.xml automatically

I have an existing J2EE project which is very big and old. Therefore, my current building process is to open eclipse, file/export, and clic on War archive.

While our company turn over is as fast as new build is needed, we have to create an automated process. However, I’m searching the fastest way to automate building. I’m first looking to Maven2, but our application has a JDK1.4, which is lesser than the minimum 1.5.

I was looking to Maven1, but after some weirds bugs and some reading, it seems to be only an overlay to Ant. Why I’m not using directly Ant?

Here we are, I’m looking at Ant documentation and try to writing build.xml but it seems to be too much arduous with my big project. For god’s sake, when I clic to Export/War, Eclipse do the job. Why I can’t in the simplest way, reproduce or export the way Eclipse export the war file, into a build.xml or what else?

Some tools which convert Eclipse-metadata into ant-build.xml should exists. But does anyone know them ?


I don’t think that creating the ant script to be so hard. Anyway, maybe this link could help: Creating a deployable WAR file from Eclipse Project

Here is an example Ant file (copied from the linked page):

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Deploy From Eclipse to Tomcat" basedir=".">
    <property name="warfile" value="sanfran"/>
    <target name="unpack">
       <unwar src="${warfile}.war" dest="${warfile}" />
    <target name="create">
        <war destfile="${warfile}.war" webxml="WebContent/WEB-INF/web.xml" update="true">
            <classes dir="buildclasses"/>
            <fileset dir="WebContent">
                <exclude name="WEB-INF/web.xml"/>
    <target name="copy">
        <copy todir="c:tomcat5517webapps" overwrite="true">
            <fileset dir=".">
                <include name="*.war"/>
    <target name="deploy">
        <antcall target="create"/>
        <antcall target="copy"/>

Leave a Reply

Your email address will not be published. Required fields are marked *