ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathryn Rivard" <>
Subject taskdef not receiving the classpath properly?
Date Thu, 10 Apr 2008 17:53:32 GMT
I'm having bizarre problems getting ant to find the class referenced
in a taskdef (specifically with tomcat, if it matters).  The jar shows
up in the classpath reported by -diagnostics*, but ant can't find the
class during a build unless I explicitly set the classpath in the
taskdef tag**, or put it in my CLASSPATH environment variable***.
Details below.

Here is how the taskdef appears in our buildfile, which works for all
the other developers on the project:

<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/>

The buildfile assumes you've copied catalina-ant.jar from
${CATALINA_HOME}/server/lib/ to ant/lib/, which I've done.  However, I
get the following error:

 /usr0/krivard/test/build.xml:6: taskdef class
org.apache.catalina.ant.DeployTask cannot be found

* When I print the ant diagnostics, catalina-ant.jar shows up in the
lib listing as well as the classpath (newlines added for readability;
catalina's the final entry):

$ ant -diagnostics
 ANT_HOME/lib jar listing
ant.home: /usr/share/ant
catalina-ant.jar (26670 bytes)
java.class.path : /usr/share/java/ant.jar:

**If I specify catalina-ant.jar in the classpath attribute of the
taskdef, it works:

  <taskdef name="deploy"

This is not really an acceptable solution, since our buildfiles are
under version control and shared among developers who don't share my
problem.  :)

***If I specify catalina-ant.jar in my CLASSPATH environment variable, it works:

$ export CLASSPATH=/usr/share/ant/lib/catalina-ant.jar

and I end up with two copies of catalina-ant.jar in the classpath
reported by -diagnostics.  This solution is okay, but I'd like to
think I don't have to do this -- all the ant docs claim that "modern"
Java apps don't need the CLASSPATH environment variable, and I'm not
keen on cluttering my classpath like that.  It's worth noting that
putting a random nonzero value in the CLASSPATH environment variable
(like /dev/null or something) doesn't work.

Any ideas?  I'm running a university-rolled copy of Fedora 7, Ant
1.6.5, and Tomcat 5.5.23.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message