I would like to include all the jars present in dir,dir1,dir2,dir3,dir4,dir5. I dont want to define path id for each folder.Is there any way using dirset or fileset i can achieve this or is there any better way
Thanks Santhosh for quick response.but thing is that all these jars are not under one folder
dir/lib
dir1/lib
dir2/lib
dir3/xyz/lib
dir4/abc/lib.....like this 20 directories
if it is inside one parent folder then I would have done using your way. So I thought i would put this in the property file and loop through each folder to create the classpath usingdirset as follow.
Earlier i had done that way but it made my build file very large.so I thought I will move these directory listing to property file and in build file I will use some loop or macro which will loop throgh these directories and create the build classpath
To include all of the jar files within a directory and all subdirectories, use "<includes>**/*.jar</includes>".
By the way, is this a classpath for running or for compiling? For compiling you only need to include the JARs that contain the classes mentioned in your import statements. For example, you might be using commons-logging with log4j. Only the commons-logging JAR is required to be in the classpath at compile time; but at runtime you would need both JARs.
1. First in build.properties I defined a variable that will list the lib dirs.
lib.dirs=\
DAS/lib,\
DAS-UI/lib,\
DPS/lib,\
DSS/lib,\
DCS/lib,\
DAF/Search/Index/lib,\
DAF/Search/Query/lib,\
DAF/Search/common/lib
2. Then in build.xmls, compile target I am forming the classpath as below.
<target name="compile" depends="init" description="Compiles the source code to the build directory.">
<var name="compile.class.path" value="" /> <!-- Defined a variable with null value -->
<!-- Loop throgh the list lib.dirs -->
<for list="${lib.dirs}" param="pathitem" delimiter=",">
<sequential>
<var name="compile.class.path" value="${compile.class.path},@{pathitem}/*.jar" />
</sequential>
</for>
Now "compile.class.path" will contain all your jars.