ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bailey, Darragh" <>
Subject RE: Proper way to translate list of jars from properties file into classpath
Date Tue, 19 Oct 2010 15:57:54 GMT
> -----Original Message-----
> From: KARR, DAVID (ATTSI) [] 
> Sent: 13 October 2010 21:05
> To: Ant Users List
> Subject: Proper way to translate list of jars from properties 
> file into classpath
> I have a property defined in my properties file that 
> specifies a list of
> jar files associated with a particular framework.  I'll need to
> reference all of those jars any time I reference one of them, so I put
> them in a single property.
> It currently looks like this:
> cxf-patches	= ${lib}/cxf-xjc-boolean-2.3.0.jar,\
> 		  ${lib}/cxf-xjc-bug671-2.3.0.jar,\
> 		  ${lib}/cxf-xjc-dv-2.3.0.jar,\
> 		  ${lib}/cxf-xjc-ts-2.3.0.jar
> Where I've defined "lib" in my build.xml before this file is 
> referenced
> as "${basedir}/lib".
> At this point, I'm not certain of the elements that I need to 
> get these
> jars properly referenced in a top-level path element so I can 
> reference
> it as the classpath for javac.  I imagine it involves using the
> "filelist" element.
> I tried this:
>     <filelist id="cxfXjcPatch.jars.list" files="${cxf-patches}"/>
> Then:
> 	<path id="build.classpath">
>          ...
>    	   <filelist refid="cxfXjcPatch.jars.list"/>
>          ...
>       </path>
> This doesn't produce anything really useful.  It produces very odd
> results in the final classpath.  I'm not going to bother listing it,
> because I'm sure I'm doing something basically wrong here.

Try striping the ${lib}/ reference off the paths to the jar files and use it as the directory
for the filelist.

cxf-patches	= cxf-xjc-boolean-2.3.0.jar,\

<project name="test" default="dist" basedir="." >
  <loadproperties srcFile="" />
  <property name="lib" location="${basedir}/lib" />

  <target name="dist" >
    <filelist id="cxfXjcPatch.jars.list" dir="${lib}" files="${cxf-patches}" />
    <path id="build.classpath">
      <filelist refid="cxfXjcPatch.jars.list"/>
    <echo message="${toString:build.classpath}" />


Produces the following when run for me:
[echo] /tmp/ant/lib/cxf-xjc-boolean-2.3.0.jar:/tmp/ant/lib/cxf-xjc-bug671-2.3.0.jar:/tmp/ant/lib/cxf-xjc-dv-2.3.0.jar:/tmp/ant/lib/cxf-xjc-ts-2.3.0.jar

Perhaps it was that you were trying to use filelist without setting the directory and placing
that into the property that you were passing to it?

Darragh Bailey

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message