|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
taskdef not receiving the classpath properly?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@... For additional commands, e-mail: user-help@... |
|
|
Re: taskdef not receiving the classpath properly?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@... > For additional commands, e-mail: user-help@... > > > 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@... For additional commands, e-mail: user-help@... |
|
|
Re: taskdef not receiving the classpath properly?On Fri, Apr 11, 2008 at 10:24 AM, supareno <reno.rkcrew@...> wrote:
> 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. > > > 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> Hi supareno, Those are both great examples of specifying the classpath as part of the taskdef, which I know works -- but I need a solution that does not require modifying the build.xml file. Thanks though! I just found out half my team has upgraded to ant 1.7, so that's the next thing I'm going to try. Still looking, Katie |
|
|
Re: taskdef not receiving the classpath properly?Katie,
sorry, i did not read all the thread :-) are you doing the deploiement with and editor (eclipse for example???) the thing is if you can see *catalina-ant.jar* with the command line 'ant -diagnostics', so if you type 'ant deploy', NORMALLY, it will not throw an exception because *catalina-ant.jar* is in the path... my question is: if you use 'ant deploy' in a terminal, do you always have the exception?? regards supareno > On Fri, Apr 11, 2008 at 10:24 AM, supareno <reno.rkcrew@...> wrote: > > >> 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. >>> >>> >> 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> >> > > > > Hi supareno, > > Those are both great examples of specifying the classpath as part of the > taskdef, which I know works -- but I need a solution that does not require > modifying the build.xml file. Thanks though! > > I just found out half my team has upgraded to ant 1.7, so that's the next > thing I'm going to try. > > Still looking, > Katie > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: taskdef not receiving the classpath properly?On Fri, Apr 11, 2008 at 11:59 AM, supareno <reno.rkcrew@...> wrote:
> my question is: if you use 'ant deploy' in a terminal, do you always have > the exception?? > I always build from a terminal (and not from eclipse). I think by "deploy" you mean whatever our main build target is, right? If so, then yes -- unless I put ant/lib/catalina-ant.jar in the classpath of the taskdef, or in the CLASSPATH environment variable, I always get the exception. That's what makes it so weird -- it *appears* as if catalina-ant.jar is the path, but to get it to work I either have to duplicate it using the environment variable, or give the taskdef a special classpath Katie |
|
|
Re: taskdef not receiving the classpath properly?Turns out upgrading to Ant 1.7.0 (and clearing out all the crud in Fedora 7
that makes you use the rpm version) fixed the problem -- no taskdef classpath, no CLASSPATH environment variable necessary, it works exactly how I want it to. Katie On Fri, Apr 11, 2008 at 12:09 PM, Kathryn Rivard <kathryn.rivard@...> wrote: > > > On Fri, Apr 11, 2008 at 11:59 AM, supareno <reno.rkcrew@...> wrote: > > > my question is: if you use 'ant deploy' in a terminal, do you always > > have the exception?? > > > > I always build from a terminal (and not from eclipse). I think by > "deploy" you mean whatever our main build target is, right? If so, then yes > -- unless I put ant/lib/catalina-ant.jar in the classpath of the taskdef, or > in the CLASSPATH environment variable, I always get the exception. That's > what makes it so weird -- it *appears* as if catalina-ant.jar is the path, > but to get it to work I either have to duplicate it using the environment > variable, or give the taskdef a special classpath > > Katie > > |
|
|
Re: taskdef not receiving the classpath properly?Kathryn Rivard a écrit :
> Turns out upgrading to Ant 1.7.0 (and clearing out all the crud in Fedora 7 > that makes you use the rpm version) fixed the problem -- no taskdef > classpath, no CLASSPATH environment variable necessary, it works exactly how > I want it to. > > Katie > Great ! i forgot to say that i did the test with ant 1.7 :-) > > On Fri, Apr 11, 2008 at 12:09 PM, Kathryn Rivard <kathryn.rivard@...> > wrote: > > >> On Fri, Apr 11, 2008 at 11:59 AM, supareno <reno.rkcrew@...> wrote: >> >> >>> my question is: if you use 'ant deploy' in a terminal, do you always >>> have the exception?? >>> >>> >> I always build from a terminal (and not from eclipse). I think by >> "deploy" you mean whatever our main build target is, right? If so, then yes >> -- unless I put ant/lib/catalina-ant.jar in the classpath of the taskdef, or >> in the CLASSPATH environment variable, I always get the exception. That's >> what makes it so weird -- it *appears* as if catalina-ant.jar is the path, >> but to get it to work I either have to duplicate it using the environment >> variable, or give the taskdef a special classpath >> >> Katie >> >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: taskdef not receiving the classpath properly?Kathryn Rivard wrote:
> Turns out upgrading to Ant 1.7.0 (and clearing out all the crud in Fedora 7 > that makes you use the rpm version) fixed the problem -- no taskdef > classpath, no CLASSPATH environment variable necessary, it works exactly how > I want it to. It was probably the RPM version getting in ahead of anything else...we changed the scripts in Ant1.7 so your own installation gets in there first. 1. Ant1.7 adds a -lib command to add new stuff to a lib directory 2. you can also stick jars into ~/.ant/lib, so that different users can have stuff in the classpath, even with a root-only ANT_HOME/lib -steve -- Steve Loughran http://www.1060.org/blogxter/publish/5 Author: Ant in Action http://antbook.org/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: taskdef not receiving the classpath properly?On Wed, Apr 16, 2008 at 7:19 AM, Steve Loughran <stevel@...> wrote:
> It was probably the RPM version getting in ahead of anything else...we > changed the scripts in Ant1.7 so your own installation gets in there first. Whatever you changed, it didn't work 100% for my system. To get Ant1.7 to run instead of 1.6, I had to remap /usr/bin/ant by hand, and nuke /etc/ant.conf which I'm pretty sure is a fedora thing. When installing from a binary though I kinda expect to have to massage the system to get it to work, so it wasn't a big deal. > 2. you can also stick jars into ~/.ant/lib, so that different users can > have stuff in the classpath, even with a root-only ANT_HOME/lib Definitely tried that. Putting things in ~/.ant/lib/ was just as effective as ANT_HOME/lib (neither worked for 1.6 on my system, and they failed in the same ways) -- I wish I could've figured out exactly what was wrong to be able to tell you guys, but this one may remain a mystery. Thanks Steve, Katie --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free Forum Powered by Nabble | Forum Help |