I have created a jar with the .class files and the dependency libraries which are required for executing the class files using the below jar code
<target name="jar" depends="clean">
<jar destfile="${basedir}/lib/HelloWorld.jar">
<zipgroupfileset dir="${basedir}/lib" includes="*.jar" />
<fileset dir="${basedir}" includes="/com/temp/**" />
<fileset dir="${basedir}" includes="build.properties"/>
<manifest>
<attribute name="Class-Path" value="./HelloWorld.jar"/>
</manifest>
</jar>
</target>
Now i have written other build.xml to run taskdef actions using this jar but the following error occurs when i try to invoke the class files using the taskdef actions even though the class files and their dependencies are present in the same jar.
BUILD FAILED C:\Users\kh2139\Desktop\New folder\build.xml:4: taskdef class com.temp.install.common.action.UserInstallDirRule cannot be found using the classloader AntClassLoader[C:\Users\kh2139\Desktop\New folder\HelloWorld.jar]
Attaching my build.xml code below which is used to run taskdef actions on the HelloWorld.jar
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="MyTask" basedir="." default="use">
<target name="use" description="Use the Task" >
<taskdef name="helloworld1" classname="com.temp.install.common.action.UserInstallDirRule" classpath="HelloWorld.jar"/>
<helloworld1/>
<taskdef name="helloworld" classname="com.temp.install.common.action.EncryptionGUID" classpath="HelloWorld.jar"/>
<helloworld/>
</target>
</project>
PS: I could able to run the build.xml file successfully without errors when i specify the lib folder in the location where i place HelloWorld.jar and give the classpath to the lib folder in the taskdef actions.
But my issue is i want to use the same jar to contain the dependencies that are used while executing the classes.