• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help with Ant

 
bobby, morkos
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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>
 
Joe Gilvary
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • 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
 
Greg Brouelette
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic