ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Ant Task - Details
Date Tue, 19 Aug 2003 06:54:12 GMT
That class (MyVeryOwnTask.class) is not in Ant´s classpath.
a) use the classpath attribute of <taskdef>
b) create a jar containing that class and put it into <ant_home>/lib
   (or better in <user_dir>/.ant/lib - but works only with newer version
   of Ant (1.6))

> -----Original Message-----
> From: Andrei [mailto:andrei@netrom.ro]
> Sent: Tuesday, August 19, 2003 8:50 AM
> To: Ant Users List
> Subject: Ant Task - Details
> 
> 
>         Simon, i 've already done that, but i think something missing.
> This is what i've done so far.
> 
>         I have a project containing the package  
> be.unid.generate and i want to write an Ant Task to perform 
> some things. I made a class named
> MyVeryOwnTask in the package extending the Task class.
> 
> Here is the class code:
> 
> 
> package be.unid.generate;
> 
> 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;
>     }
> }
> 
>         In the Build File I added at the bigining the following:
> 
> 
>          <taskdef name="mytask"
>             classname="be.unid.generate.MyVeryOwnTask"
>          />
> 
> 
> and the target:
> 
>     <target name="task">
>       <mytask message="Hello World! MyVeryOwnTask works!"/>
>     </target>
> 
> and at build time i get the error :
> 
> taskdef class be.unid.generate.MyVeryOwnTask cannot be found 
> and build process stops
> 
> 
> What this means and what can i do?
> 
> 
>                                                               
>               Andrei
> 
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message