File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes use Ant in Eclipse 3.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "use Ant in Eclipse 3.1" Watch "use Ant in Eclipse 3.1" New topic
Author

use Ant in Eclipse 3.1

meimei li
Greenhorn

Joined: May 19, 2003
Posts: 24
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}" />
</copy>
</target>

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

<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" />

</war>
</target>

</project>

Thanks.


SCJP
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
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.
 
Don't get me started about those stupid light bulbs.
 
subject: use Ant in Eclipse 3.1