ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fotis Jannidis" <Fotis.Janni...@lrz.uni-muenchen.de>
Subject problem with writing a task
Date Thu, 02 Mar 2000 23:52:08 GMT
Hello,
I have problems to write a task. The example in the doc files doesn't work (it uses two 
variables, 'msg' and 'message'):

public class MyVeryOwnTask extends Task {
      private String msg;

      // The method executing the task
      public void execute() throws BuildException {
        System.out.println(message);
      }

      // The setter for the "message" attribute
      public void setMessage(String msg) {
        this.msg = msg;
      }
 }

Even if I set everything to 'message' I get a nullpointerexception thrown by  
org.apache.tools.ant.Project.createTask(Project.java)

I tried it without any attributes and setters in the class, but had the same result. I also

tried different approaches to make the new task class accessible: putting it into the 
classpath or putting it into /jre/lib/ext: nothing helped. From the commandline a man 
method in this class is accessible.

I use jdk 1.2.2 on win 98. 

Maybe somebody could point me to a working example?
Thanks in advance,
Fotis

BTW: 
In the ant docs the next example would profit by using the same attribute, that is 
'message', instead of myattr:

      <target name="test">
        <mytask myattr="wombat" />
      </target>

Another point: If you subscribe to ant-dev, you get a help file which repeatedly points 
you to jakarta-apache.org, p.e. in <ant-dev-faq@jakarta-apache.org>, which must be 
jakarta.apache.org



Mime
View raw message