ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kuiper, Arnout" <Arnout.Kui...@nl.origin-it.com>
Subject RE: problem with writing a task
Date Fri, 03 Mar 2000 09:50:53 GMT
Hi,

I just tested it against the latest Ant release, and it worked.

Below are the testfiles I used. I'll review the docs, and put these files in
an example directory in the Ant distribution.

Cheers,

  Arnout

test.bat:
=====
set classpath=d:\jdk1.2.2\lib\tools.jar;ant.jar;xml.jar;.
java org.apache.tools.ant.Main
=====

build.xml:
=====
<?xml version="1.0"?>

<project name="Test" default="test" basedir=".">
  <target name="init">
    <taskdef name="mytask" class="MyVeryOwnTask"/>
  </target>
  <target name="test" depends="init">
    <mytask message="wombat" />
  </target>
</project>
=====

MyVeryOwnTask.java:
=====
import org.apache.tools.ant.*;

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

Mime
View raw message