ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Platform independend classpath in build.xml?
Date Wed, 31 May 2000 13:10:52 GMT
>>>>> "JG" == Jean-Noel Gadreau <> writes:

 JG> Moreover, I think the same problem will arise for other path
 JG> (like for .DLL or .so needed by some JNI classes for
 JG> instance). How about defining a task that is able to add path to
 JG> a list in a crossplatform way, which would not be limited just to
 JG> CLASSPATH. This way, if you need to specify PATH (to find a tool
 JG> or something), we could use the same class.

Please let's not reinvent the wheel. Thomas Haas has built what you're
describing and has sent it as part of our JUnit task.

The current implementation consists of two classes Path and
PathElement. Citing from his javadocs - deHTMLed for readability:

 * This object represents a path as used by CLASSPATH or PATH
 * environment variable.
 * It consists of a list of <code>PathElement</code> and <code>Path</code>
 * objects. It is used to represent a classpath or path like nested parameters
 * in task definitions:
 * <code>
 * <sometask><br>
 *   <somepath>
 *     <element location="/path/to/file.jar" />
 *     <element path="/path/to/file2.jar:/path/to/class2;/path/to/class3" />
 *     <element location="/path/to/file3.jar" />
 *     <element location="/path/to/file4.jar" />
 *   </somepath>
 * </sometask><br>
 * </code> 
 * The object implemention <code>sometask</code> must provide a method called
 * <code>createSomepath</code> which returns an instance of <code>Path</code>.
 * Nested path definitions are handled by the Path object and must be labeled
 * <code>path</code>.<p>
 * The path element takes a parameter <code>path</code> which will be parsed
 * and split into <code>PathElement</code> objects. It will usually be used
 * to define a path from an environment variable.
 * @author

This class takes care of all the platform dependent stuff.

using this and nested elements wherever path like structures are
needed should suffice.

Thomas is on vacation AFAIK but I hope he will get back to this
soon. Thomas is a commiter so he can make these changes quicker than I
could put together the necessary patch.


View raw message