ant-user mailing list archives

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



Mime
View raw message