Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic