Now days the projects are very complex and they need some specific jar files or library files for the buid process. You can specify CLASSPATH in a Ant Script and include the required libraries. Wherever path-like values need to be specified, a nested element can be used. This takes the general form of: <classpath> <pathelement path="${classpath}"/> </classpath> or <path> <pathelement path="${classpath}"/> </path>. For example the following script will include the helper.jar file in the classpath.


 


<classpath path="${classpath}"/> <pathelement location="lib/helper.jar"/> </classpath>


 


The location attribute specifies a single file or directory relative to the project's base directory (or an absolute filename), while the path attribute accepts colon- or semicolon-separated lists of locations. The path attribute is intended to be used with predefined paths - in any other case, multiple elements with location attributes should be preferred.


 


If you want to use the same path-like structure for several tasks, you can define them with a <path> element at the same level as target s, and reference them via their id attribute. For example:-


 


<path id="base.path" path="${classpath}"> <pathelement location="lib/helper.jar"/></path>


<path id="tests.path"> <path refid="base.path"/> <pathelement location="testclasses"/>

                    

Copyright © 2013 VisualBuilder. All rights reserved