ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gale, Paul" <pg...@clicktactics.com>
Subject RE: Newbie question
Date Fri, 28 Sep 2001 20:24:01 GMT
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:\jakar
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

Mime
View raw message