ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject RE: Newbie question
Date Fri, 28 Sep 2001 21:04:43 GMT
How are you creating the jar-file? Your MyVeryOwnTask.class should be in
<somepath>/com/mydomain, and you should be in the directory that "com" is
a subdir of and say 'jar cvfM my.jar com' (the "v" and "M" flags are
optional -- I just always put them in, so I typed it that way out of
habit). Then move my.jar to $ANT_HOME/lib and it should work.

Diane

--- "Gale, Paul" <pgale@clicktactics.com> wrote:
> Good suggestion! Changed the my.jar file.
> 
> Tried it. Still same error.
> 
> Anyone else got any other ideas?
> 
> Paul
> 
> -----Original Message-----
> From: Robert Seeger [mailto:rseeger@nortelnetworks.com]
> Sent: Friday, September 28, 2001 4:38 PM
> To: ant-user@jakarta.apache.org
> Subject: RE: Newbie question
> 
> 
> I'm new to this list, and I may be missing something, but it appears to
> me
> that there may be a problem with your package name:
> 
> - The taskdef defines the class as com.mydomain.MyVeryOwnTask
> - The jarfile paths seems to define the class as
> jakarta-ant-1.4/Test/MyVeryOwnTask.class
> 
> Should the jarfile entry be either:
> - jakarta-ant-1.4/Test/com/mydomain/MyVeryOwnTask.class
> or 
> - com/mydomain/MyVeryOwnTask.class
> 
> Just throwing out a thought :)
> 
> Rob Seeger
> 
> At 04:24 PM 9/28/01 -0400, you wrote:
> >I understand. My interpretation of the document was to do just that. No
> >matter.
> >
> >I followed your instructions and created a my.jar and placed it in
> >C:\jakarta-ant-1.4\lib. Still get the same error.
> >
> >I commented the @echo off out from ant.bat to see the arguments being
> passed
> >and everything seemed okay:
> >
> >"C:\jdk1.3.1_01\bin\java" -classpath
>
>"C:\jdk1.3.1_01\lib\tools.jar;C:\jakarta-ant-1.4\lib\my.jar;C:\jakarta-ant-
> 1
>
>.4\lib\jakarta-ant-1.4-optional.jar;C:\jakarta-ant-1.4\lib\jaxp.jar;C:\jaka
> r
> >ta-ant-1.4\lib\crimson.jar;C:\jakarta-ant-1.4\lib\ant.jar;.\;"
> >-Dant.home="C:\jakarta-ant-1.4"  org.apache.tools.ant.Main
> >
> >CLASSPATH is set to .\
> >
> >Error:
> >C:\jakarta-ant-1.4\Test\build.xml:4: taskdef class
> >com.mydomain.MyVeryOwnTask cannot be found
> >
> >Running jar against the contents of my.jar reveals:
> >
> >>jar tvf my.jar
> >     0 Fri Sep 28 16:19:30 EDT 2001 META-INF/
> >    71 Fri Sep 28 16:19:30 EDT 2001 META-INF/MANIFEST.MF
> >   586 Fri Sep 28 14:37:20 EDT 2001
> jakarta-ant-1.4/Test/MyVeryOwnTask.class
> >
> >I'm stumped.
> >
> >Paul
> >
> >-----Original Message-----
> >From: Diane Holt [mailto:holtdl@yahoo.com]
> >Sent: Friday, September 28, 2001 4:05 PM
> >To: ant-user@jakarta.apache.org
> >Subject: Re: Newbie question
> >
> >
> >I wouldn't recommend putting it in the optional jar-file and adding it
> to
> >defaults.properties, since it's best to avoid changing the
> off-the-shelf
> >Ant stuff. Instead, try jar'ing up com/mydomain/MyVeryOwnTask.class
> into
> >my.jar (or whatever) and putting that into $ANT_HOME/lib.
> >
> >Diane
> >
> >--- "Gale, Paul" <pgale@clicktactics.com> wrote:
> >> Hi,
> >> 
> >> Apologies if this the wrong forum:
> >> 
> >> I've been trying out Ant using the example from the doc, namely:
> >> 
> >> package com.mydomain;
> >> 
> >> import org.apache.tools.ant.BuildException;
> >> import org.apache.tools.ant.Task;
> >> 
> >> public class MyVeryOwnTask extends Task {
> >>   private String msg;
> >> 
> >>   // The method executing the task
> >>   public void execute() throws BuildException {
> >>     System.out.println(msg);
> >>   }
> >> 
> >>   // The setter for the "message" attribute
> >>   public void setMessage(String msg) {
> >>     this.msg = msg;
> >>   }
> >> }
> >> 
> >> and using the sample build.xml file provided. 
> >> 
> >> <?xml version="1.0"?>
> >> 
> >> <project name="OwnTaskExample" default="main" basedir=".">
> >>   <taskdef name="mytask" classname="com.mydomain.MyVeryOwnTask"/>
> >> 
> >>   <target name="main">
> >>     <mytask message="Hello World! MyVeryOwnTask works!"/> 
> >>   </target>
> >> </project>
> >> 
> >> 
> >> However, it fails to run, with the error:
> >>  taskdef class com.mydomain.MyVeryOwnTask cannot be found
> >> 
> >> I have the class file in the same directory from where build.xml is
> >> executed
> >> and on the classpath. 
> >> 
> >> I've tried removing the 'taskdef' element from the build.xml file and
> >> added
> >> the MyVeryOwnTask.class file using jar.exe to
> >> jakarta-ant-1.4-optional.jar
> >> and to the default properties file. Still nothing. 
> >> 
> >> What am I missing here? Something blatant no doubt, but I'm out of
> >> ideas.
> >> I've checked all the doc and can't find a solution.
> >> 
> >> All help is much appreciated.
> >> 
> >> Paul
> >> 
> >> 
> >
> >
> >=====
> >(holtdl@yahoo.com)
> >
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Listen to your Yahoo! Mail messages from any phone.
> >http://phone.yahoo.com
> >
> ========================================
> Robert Seeger
> Network Engineer
> Nortel Networks
> 
> Telephone:	(518)237-2087
> Pager:		(800)SKY-8888  Pin#1264792
> Fax:		(518)237-4190
> Email:		rseeger@nortelnetworks.com
> Address:	224 5th Ave, Apt#2
> 		Lansingburgh, NY 12182
> ========================================


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

Mime
View raw message