ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Ayad" <ma...@ogilvy.net>
Subject RE: MyVeryOwnTask
Date Thu, 18 Oct 2001 21:04:06 GMT
There are two parts


1) The class file Which performs the task, once compiled
it must appear in the classpath (as the documentation says)

2) The build.xml file which is mapped to the class:

 <taskdef name="mytask" classname="com.mydomain.MyVeryOwnTask"/>


<?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>

Regards

Mark

-----Original Message-----
From: Christine.Woon@nurun.com [mailto:Christine.Woon@nurun.com]
Sent: Thursday, October 18, 2001 10:20 PM
To: ant-user@jakarta.apache.org
Subject: MyVeryOwnTask



Hi guys,

How do I acutally implement this in a build.xml file?

-----------------------------------------------------------------
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import java.util.*;

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;
  }
}
-------------------------------------------------------------------

I know I put this in my init target: <taskdef name="MyVeryOwnTask"
classname="MyVeryOwnTask"/>
but I'm not sure where I specify the actual 'msg' that I want to print out
to the screen, except that now
I can do this: <MyVeryOwnTask ........./>

thanks



Mime
View raw message