• Post Reply Bookmark Topic Watch Topic
  • New Topic

use Ant in Eclipse 3.1  RSS feed

meimei li
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a Tomcat project called "jsflogin" inside the eclipse IDE, added an ant build file "build.xml" under "jsflogin". It seems the IDE does recognize it'a an ant build file since an ant icon appears together with the file. However, after I select "Project"->"Build project" or "Build all", the project is not built.

I downloaded this JSF demo from www.javaranch.com/newsletter/200404/JSF_Part1.html and am trying to learn JSF.

What else should I do? Here is the build.xml file.

<?xml version="1.0" ?>
<project name="jsflogin" default="deploy" basedir=".">

<property name="name" value="jsflogin" />
<property name="src.dir" value="src" />
<property name="classes.dir" value="classes" />
<property name="deploy.name" value="${name}.war"/>
<property name="deploy.dir" value="deploy" />
<property name="lib.dir" value="WEB-INF\lib" />
<property name="jsp.dir" value="pages" />
<property name="resources.dir" value="resources" />

<target name="init">
<mkdir dir="${deploy.dir}" />
<mkdir dir="${classes.dir}" />
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}" />

<target name="compile" depends="init">
<javac srcdir="${src.dir}"
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>

<target name="deploy" depends="compile">
<war destfile="${deploy.dir}/${deploy.name}" webxml="WEB-INF/web.xml">
<fileset dir="${jsp.dir}" includes="**\*" />
<lib dir="${lib.dir}" />
<classes dir="${classes.dir}" />
<webinf dir="WEB-INF" includes="**\*.xml" />



Carol Enderlin
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Project - Build would have eclipse build the project based on the way Project properties is configured. Looks like configure it with an ant builder, I haven't used that...check the help on ant builder.

From the eclipse help I searched on "run ant build" and one of the top hits is a common way to run ant buildfiles:

1. Select build.xml in one of the navigation views and choose Run As > Ant Build... from its context menu. (e.g. right click on build.xml)

2. A launch configuration dialog is opened on a launch configuration for this Ant buildfile.

3. This dialog allows the configuration of many aspects of the way an Ant buildfile is run, check the Targets tab which allows the selection of which Ant targets to run and their order if not planning to run the default.

4. Click Run.

5. The Ant buildfile is run, and the output is sent to the Console view.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!