ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurd...@yahoo.com>
Subject RE: how to make a classpath like "/java/lib/*.jar"? once for a multijavac task build file.
Date Thu, 26 Oct 2000 12:14:44 GMT

Hi,

You can do this using

<path id="someid">
	<fileset .../>
</path>

<javac ...>
	<classpath refid="someid"/>
<javac>

Note that the classpath must be defined using a <path> element, not a
<classpath> element.


Adam

> -----Original Message-----
> From: Barrie Treloar [mailto:Barrie.Treloar@camtech.com.au]
> Sent: Thursday, 26 October 2000 10:50 AM
> To: ant-user@jakarta.apache.org; emeade@geekfarm.org
> Subject: Re: how to make a classpath like "/java/lib/*.jar"? once for a
> multijavac task build file.
>
>
> On Wed, 25 Oct 2000, Erik Meade wrote:
>
> > Nico posted this a while back when asked 'how to make a classpath like
> > "/java/lib/*.jar"?'
> >
> > >     <javac  srcdir="${build.src}"
> > >             destdir="${build.classes}"
> > >             includes="**/*.java"
> > >             debug="off" optimize="on">
> > >       <classpath>
> > >         <fileset dir="${build.lib}">
> > >           <include name="**/*.jar" />
> > >         </fileset>
> > >         <fileset dir="${build.current}">
> > >           <include name="**/*.jar" />
> > >         </fileset>
> > >       </classpath>
> > >     </javac>
> >
> > Does anyone know of a way to "do this" for the classpath in
> such a way that
> > I don't
> > have to cut and past this into the 13 javac tasks in a build file?
>
> You can do this:
>
>        <!-- Include id attributes to fileset so they can be -->
>        <!-- xml pasted into other tags -->
>
>        <classpath>
>          <fileset id="classpath.build.lib" dir="${build.lib}">
>            <include name="**/*.jar" />
>          </fileset>
>          <fileset id="classpath.build.current" dir="${build.current}">
>            <include name="**/*.jar" />
>          </fileset>
>        </classpath>
>
> And then in another classpath declaration
>
>        <classpath>
>          <fileset refid="classpath.build.lib" />
>          <fileset refid="classpath.build.current" />
>        </classpath>
>
> What is annoying at the moment is that I must define sub-path elements
> to classpath so that I can then textually include them via the refid
> construct.  As thats all the refid does, a textual copy of the xml
> structure.
>
> It would be more intuitive if I could give classpath an id and then
> use that as a base to extend from.
>
> Note: the following does not work with ant, I'm hoping someone can
> come up with a way to get soemthing like it to work.
>
>        <!-- A classpath for compilation -->
> 	   <classpath id="classpath>
>           <pathelement location="..." />
>           <...>
>        </classpath>
>
>        <!-- A classpath for testing it just merely  -->
>        <!-- adds the directory where the classes where compiled -->
>        <!-- to the one used to compile the classes, perhaps including -->
>        <!-- some additional runtime jars -->
>        <classpath refid="classpath>
>           <pathelement location="compilation.directory" />
>        </classpath>
>
> The way I have to do this now is to
> 	- somehow wrap the <pathelement> tags into a structure I can use
>       the refid attribute (couldn't work out a way to do this)
>     - cut-and-paste
>     - include the additional values in the compile classpath (even
>       though they are not needed) and then reference that classpath
>       elsewhere.  This isn't any more sophisticated than defining
>       a classpath property and using that in the classpath
>       declarations.
>
> Barrie
> --
> Barrie Treloar
> ____________________________________________________________________
>
>   Barrie Treloar                      Phone: +61 8 8303 3300
>   Senior Analyst/Programmer           Fax:   +61 8 8303 4403
>   Electronic Commerce Division        Email: barrie@camtech.com.au
>   Camtech (SA) Pty Ltd                http://www.camtech.com.au
>  --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
> ____________________________________________________________________
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Mime
View raw message