• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help with Ant

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic