ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From supareno <reno.rkc...@free.fr>
Subject Re: taskdef not receiving the classpath properly?
Date Fri, 11 Apr 2008 14:24:21 GMT
Kathryn Rivard a écrit :
> 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:
>
>  BUILD FAILED
>  /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:
> /usr/share/java/ant-launcher.jar:
> /usr/share/java/jaxp_parser_impl.jar:
> /usr/share/java/xml-commons-apis.jar:
> /usr/share/java/antlr.jar:
> /usr/share/java/ant/ant-antlr.jar:
> /usr/share/java/bcel.jar:
> /usr/share/java/ant/ant-apache-bcel.jar:
> /usr/share/java/bsf.jar:
> /usr/share/java/ant/ant-apache-bsf.jar:
> /usr/share/java/log4j.jar:
> /usr/share/java/ant/ant-apache-log4j.jar:
> /usr/share/java/oro.jar:
> /usr/share/java/ant/ant-apache-oro.jar:
> /usr/share/java/regexp.jar:
> /usr/share/java/ant/ant-apache-regexp.jar:
> /usr/share/java/xml-commons-resolver.jar:
> /usr/share/java/ant/ant-apache-resolver.jar:
> /usr/share/java/jakarta-commons-logging.jar:
> /usr/share/java/ant/ant-commons-logging.jar:
> /usr/share/java/javamail.jar:
> /usr/share/java/jaf.jar:
> /usr/share/java/ant/ant-javamail.jar:
> /usr/share/java/jdepend.jar:
> /usr/share/java/ant/ant-jdepend.jar:
> /usr/share/java/jsch.jar:
> /usr/share/java/ant/ant-jsch.jar:
> /usr/share/java/junit.jar:
> /usr/share/java/ant/ant-junit.jar:
> /usr/share/java/ant/ant-nodeps.jar:
> /usr/share/java/ant/ant-swing.jar:
> /usr/share/java/jaxp_transform_impl.jar:
> /usr/share/java/ant/ant-trax.jar:
> /usr/lib/jvm/java/lib/tools.jar:
> /usr/share/ant/lib/catalina-ant.jar
>
>
> **If I specify catalina-ant.jar in the classpath attribute of the
> taskdef, it works:
>
>  <taskdef name="deploy"
> classname="org.apache.catalina.ant.DeployTask"
> classpath="/usr/share/ant/lib/catalina-ant.jar"/>
>
> 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.
>
> Thanks,
> Katie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   
hi katie,
you could try this:

<path id="tomcat.classpath">
   <fileset dir="${tomcat.home}/server/lib" includes="catalina-ant.jar" />
</path>
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
   <classpath refid="tomcat.classpath" />
</taskdef>

or

<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
   <classpath>
      <path location="${appserver.home}/server/lib/catalina-ant.jar"/>
   </classpath>
</taskdef>

i don't why your build does not work but i know that this one is working..

hope this help

regards
supareno

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message