You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by lu...@chipcity.com.au on 2005/09/03 09:36:27 UTC
classpath problem
Hi.
I've searched for a solution on this list, faq and google.
It's probably very simple. I am a beginner with ant.
I want to compile some files that are part of a webapp.
So they need the servlet-api.jar file.
When I run ant with the following build.xml file it can't find the
javax.servlet.* classes.
I've added a <classpath> element as below.
What am I doing wrong?
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<project name="megaboard01" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="../megaboard02/src/java"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
<classpath>
<pathelement location="/progs/jakarta-tomcat-5.5.9/common/lib/servlet-api.jar"/>
</classpath>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
\_________
Thanks.
Kind regards.
Luke.
--
............._..
.| .| |.|/.|_ .
.|__.|_|.|\.|_ .
:61 421 276 282:
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: classpath problem
Posted by lu...@chipcity.com.au.
Hi.
05Sep2005 @ 10:11 Petar Tahchiev thusly spake
> > Probably you have to enlose the <classpath> tag in your <javac> tag like
> this:
> <javac BLAH BLAH>
> <classpath>
> BLAH BLAH
> </classpath>
> </javac>
Thanks!
Kind regards.
Luke.
--
............._..
.| .| |.|/.|_ .
.|__.|_|.|\.|_ .
:61 421 276 282:
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: classpath problem
Posted by Petar Tahchiev <pa...@gmail.com>.
On 03/09/05, luke@chipcity.com.au <lu...@chipcity.com.au> wrote:
>
> Hi.
>
> I've searched for a solution on this list, faq and google.
> It's probably very simple. I am a beginner with ant.
>
> I want to compile some files that are part of a webapp.
> So they need the servlet-api.jar file.
>
> When I run ant with the following build.xml file it can't find the
> javax.servlet.* classes.
>
> I've added a <classpath> element as below.
> What am I doing wrong?
>
> /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> <project name="megaboard01" default="dist" basedir=".">
> <description>
> simple example build file
> </description>
> <!-- set global properties for this build -->
> <property name="src" location="../megaboard02/src/java"/>
> <property name="build" location="build"/>
> <property name="dist" location="dist"/>
>
> <target name="init">
> <!-- Create the time stamp -->
> <tstamp/>
> <!-- Create the build directory structure used by compile -->
> <mkdir dir="${build}"/>
> </target>
>
> <target name="compile" depends="init"
> description="compile the source " >
> <!-- Compile the java code from ${src} into ${build} -->
> <javac srcdir="${src}" destdir="${build}"/>
> <classpath>
> <pathelement location="/progs/jakarta-tomcat-5.5.9/common/lib/servlet-
> api.jar"/>
> </classpath>
> </target>
>
> <target name="dist" depends="compile"
> description="generate the distribution" >
> <!-- Create the distribution directory -->
> <mkdir dir="${dist}/lib"/>
>
> <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
> <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
> </target>
>
> <target name="clean"
> description="clean up" >
> <!-- Delete the ${build} and ${dist} directory trees -->
> <delete dir="${build}"/>
> <delete dir="${dist}"/>
> </target>
> </project>
> \_________
>
>
> Thanks.
> Kind regards.
> Luke.
> --
> ............._..
> .| .| |.|/.|_ .
> .|__.|_|.|\.|_ .
> :61 421 276 282:
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
> Probably you have to enlose the <classpath> tag in your <javac> tag like
this:
<javac BLAH BLAH>
<classpath>
BLAH BLAH
</classpath>
</javac>
--
Regards, Petar!