Two Laptop Bag*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need help with Ant " Watch "Need help with Ant " New topic
Author

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}">
<classpath>
<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"/>
</classpath>
</javac>
</target>
Joe Gilvary
Ranch Hand

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

HTH,
Joe
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"
destdir="./build"
deprecation="on"
classpathref="project.class.path"/>
</target>
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}/classes12.zip"/>
<pathelement path="${mqlib}/com.ibm.mq.jar"/>
<pathelement path="${WASlib}/ibmwebas.jar"/>
<pathelement path="${WASlib}/xerces.jar"/>
</path>
Hope it helps


For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with Ant