You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Matthew Hardin <ma...@hardin.net> on 2003/03/17 22:59:55 UTC
classpath
Is it possible to set a classpath element that can be
used throughout your build file? In other words, I have
several java and javac tasks within my file that all
use the same classpath. Yet it seems I have to define
it for everyone. How can I consolidate this to one
place so I only have to make one change when it needs
updating?
Thanks,
Matthew Hardin
Matthew Hardin
matthew@hardin.net
Re: classpath
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
You've just touched on one of the nicest things about Ant... its path
handling. Yes, Ant can do this easily, for example:
<path id="common.compile.classpath">
<pathelement location="${lucene.jar}"/>
</path>
<path id="common.test.classpath">
<pathelement location="${junit.jar}"/>
<path refid="common.compile.classpath"/>
</path>
So common path is defined and then a larger path is constructed using
it (nevermind the property references for now, if you aren't familiar
with the ${...} syntax).
Then use either classpathref="common.compile.classpath" on <java> and
<javac> or use the nested <classpath> element with the same nested
<path refid="..."> construct as shown above to pull in a previously
defined path.
Erik
On Monday, March 17, 2003, at 04:59 PM, Matthew Hardin wrote:
> Is it possible to set a classpath element that can be
> used throughout your build file? In other words, I have
> several java and javac tasks within my file that all
> use the same classpath. Yet it seems I have to define
> it for everyone. How can I consolidate this to one
> place so I only have to make one change when it needs
> updating?
>
> Thanks,
> Matthew Hardin
>
> Matthew Hardin
> matthew@hardin.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>