Advertisement

10.31.2007 at 10:33AM PDT, ID: 22930399
[x]
Attachment Details

Adding JAR files to Ant build file

Asked by scotiaceilidh in J2EE, Java Programming Language, Open Source Programming

Tags: jar, ant, file, build

I am new to ANT, and am trying to setup a build file that will take the JAR files from my project lib directory, and allow my compiler to utilize the jar files when I run an Ant target.  My build.xml file is in the root of my web app project directory, and I need to include the servlet.jar file when I compile my java code. Here is my basic build.xml file

<project name="MVC" default="all" basedir=".">
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="lib.dir" value="lib"/>
<target name="merge"  description="Builds the entire project">
      <echo>Doing merge</echo>
      <javac srcdir="${src.dir}" destdir="${build.dir}"/>
</target>
</project>

How do I get the servlet.jar file, which is in my lib directory, to be utilized when calling the "merge" target?  There will be many other jar files for other projects, so I don't want to have to add them to my classpath in my environmental variables.

ThanksStart Free Trial
[+][-]10.31.2007 at 11:34AM PDT, ID: 20187950

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: J2EE, Java Programming Language, Open Source Programming
Tags: jar, ant, file, build
Sign Up Now!
Solution Provided By: ForceRs
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10.31.2007 at 11:38AM PDT, ID: 20187977

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.31.2007 at 02:25PM PDT, ID: 20189201

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628