Meaningless Drivel is fun!
The moose likes Java in General and the fly likes Need help with Ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need help with Ant " Watch "Need help with Ant " New topic

Need help with Ant

bobby, morkos
Ranch Hand

Joined: Jan 04, 2002
Posts: 82
I want to add all the jars with one line command. Something like this:
<pathelement location="${jar}/*.jar"/> it does not work, could somoene help.
This works below, but I have to add every jar:
<target name="compile" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}">
<pathelement location="${jar}/mysql_2_comp.jar"/>
<pathelement location="${jar}/Activation.jar"/>
<pathelement location="${jar}/mail.jar"/>
<pathelement location="${jar}/log4j.jar"/>
<pathelement location="${jar}/log4j-core.jar"/>
<pathelement location="${jar}/xerces.jar"/>
Joe Gilvary
Ranch Hand

Joined: May 11, 2001
Posts: 152
The Ant Manual at
includes this example:
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
<pathelement location="classes"/>

Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
I do this: My compile target looks like this:
<target name="compile" depends="message, init">
<mkdir dir="./build" />
<javac srcdir="./src"
Notice how it uses a classpathref. I define the classpath ref like this:
<path id="project.class.path">
<pathelement location="./build"/>
<pathelement path="${WASlib}/servlet.jar" />
<pathelement path="${J2EElib}/j2ee.jar" />
<pathelement path="${WASlib}/ibmjndi.jar"/>
<pathelement path="${oraclelib}/"/>
<pathelement path="${mqlib}/"/>
<pathelement path="${WASlib}/ibmwebas.jar"/>
<pathelement path="${WASlib}/xerces.jar"/>
Hope it helps

For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
I agree. Here's the link:
subject: Need help with Ant
jQuery in Action, 3rd edition