ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: <path> and <classpath> - interchangeable?
Date Mon, 23 Aug 2010 04:05:25 GMT
On 2010-08-23, Michael Ludwig wrote:

> I'm wondering what's the difference between <path> and <classpath>.
> Why are there these two construct? Aren't they functionally identical?

Ant contains a type - a thing you can define outside of tasks - called
<path>.  This Ant type is backed by a Java class named Path.

Some tasks support nested elements that are implemented by that same
Java class.  Some tasks class it <path>, others call it <classpath> and
there are even more names used by tasks.

This means that you can use <path id="foo"> somewhere outside of a task
and use that via <classpath refid="foo"/> in a task that calls its
nested element <classpath>.

> Is it correct to say that the whole <path>/<classpath> thing can be
> explained historically by reference to the <javac> task? Which sports
> @classpath, @sourcepath, @bootclasspath and @extdirs, all <path> types?

Not really.

<javac> is a good example, it needs four different types of path
structures so it needs four different names for them.  For <exec> the
name <path> is the natural one.

For the thing you can define outside of tasks, we need only one name and
<path> is the most generic one.

> So are <path> and <classpath> interchangeable?

Structurally, yes.  But if the task calls its nested element <classpath>
then you have to use that name and can't call it <path>.


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

View raw message