I have some issues in setting the classpath for the a project for which Im trying to create a jar using the Ant build script. For eg: Consider a project A in the workspace. This project has internal dependencies with other projects in the workspace. There are project B, C, D in my workspace, which are added to the build path of the Project A. I have the below compile script in the build.xml. When I try to execute the script, the compile does not seem to happen, due to issues with classpath. Please find the code below.
<target name="compileBusla" description="description">
<antcall target="clean"></antcall>
<echo message="Creating directory '${target}' if not present "></echo>
<mkdir dir="${target}"/>
<mkdir dir="${Classfiles}"/>
<javac srcdir="../A/src" destdir="${Classfiles}" />
<classpath>
<pathelement location="../B" path="src" />
<pathelement location="../C" path="src"/>
<pathelement location="../D" path="src" />
</classpath>
</target>
When I try to execute the script, I get the error at this line ” saying that compilation fails. Require help in setting the classpath in the buildscript. Thanks in Advance
A classpath contains directories and jars which contain compiled class files. You added the source folder of A, B and C. Add their classes folder, or the jar file generated for these projects.
Moreover, the path attribute of pathelement is not just a directory name. It’s a path. You should just use