Problem including external jar to build.xml file Ant
Joined: Mar 04, 2008
I am not getting how to add external libraries to build file used by Ant. I want to use classes12.jar and ojdbc14.jar in my java code. But i dont know how to incldue them in the existing build.xml. Here is an excerpt of my build file :
I am not sure why you are using a property - that won't do anything unless you refer to that property later when declarinf a path.
The id for path is anything - it is a name that you can use later in the build script. Therefore, is is like a property name, but speciifc for use in paths, such as a classpath. This is generally true for every place where an id can be specified.
I usually set up classpaths using two mechanisms. For specific JAR files, I use 'pathelement location', but to grab all (or almost all) of the JARfiles within a directory (and its subdirectories) I use fileset. For example, if I want to define a classpath using all of the JAR files you mentioned in the dest.classpath property, I would use:
The above makes the assumption that only the JAR files list are in those directories. (I question the use of classes12.zip - that is an really old file if I recall correctly, but I left it in there to make the example complete.)
To use the above, in a later task I would use the dest.classpath:
By the way, I really recommend a book such as Ant In Action - I have a copy of the previous edition and it was invaluable.