全部 -
我下面这个页面中最简单的说明:
http://ant.apache.org/manual/develop.html
然而,当我尝试执行目标的“主”我知道在NetBeans此错误:
taskdef class dec102012.MyAntTask cannot be found using the classloader AntClassLoader[]
但这个错误是没有意义的,因为我的扩展“任务”新的Java类看起来是这样的:
package dec102012;
import org.apache.tools.ant.BuildException;
public class MyAntTask extends org.apache.tools.ant.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;
}
}
在我的build.xml相关的部分是这样的:
<taskdef name="mytask" classname="dec102012.MyAntTask" classpath="dec102012"/>
<target name="main">
<mytask message="Hello World! MyVeryOwnTask works!"/>
</target>