...">

ClassPath in Ant for Javac Task

I have the following ant file for assembly. But unfortunately,

<project default="build.deploy.start" basedir="."> <property name="target.dir" value="C:\tom\webapp\"/> <property name="basesrc.dir" value="c:\SimpleChat\"/> <property name="classes.target" value="${basesrc.dir}\WebContent\WEB-INF\classes"/> <property name="src.dir" value="${basesrc.dir}\src"/> <property name="classpath" value="${basesrc.dir}\WebContent\WEB-INF\classes"/> <!-- Classpath for the project --> <path id="master-classpath"> <fileset dir="${classpath}"> <include name="*.jar"/> </fileset> </path> <!-- init method which will ensure that all directories exists before we start building/deploying--> <target name="init"> <mkdir dir="${target.dir}\js"/> <mkdir dir="${target.dir}\images"/> <mkdir dir="${target.dir}\pages"/> <mkdir dir="${target.dir}\WEB-INF\lib"/> <mkdir dir="${target.dir}\WEB-INF\classes"/> </target> <!--To build an application so that files can be deloyed--> <target name="build" depends="init"> <javac srcdir="${src.dir}" destdir="${classes.target}"> <classpath refid="master-classpath"/> </javac> </target> </project> 

I have the corresponding jar files in the LIB directory specified in the path element. and yet it gives a compilation error that the package does not exist, since it cannot see my JAR file.

Could you point out the mistake I am making in order to turn on this jar correctly?

+6
javac ant
source share
2 answers

Hard to say. I do not see any obvious errors.

All examples are here: http://ant.apache.org/manual/Types/fileset.html use:

 <include name="**/*.jar"/> 

instead of just "* .jar" as you have, but what you look like should be fine as long as the .jar files are directly inside \ WebContent \ WEB-INF \ classes.

+4
source share

This line should indicate where your banks

 <property name="classpath" value="${basesrc.dir}\WebContent\WEB-INF\classes"/> 

maybe

 <property name="classpath" value="${basesrc.dir}\WebContent\WEB-INF\lib"/> 
+2
source share

All Articles