简体   繁体   English

可以将蚂蚁任务归类吗?

[英]is it possible to subclass an ant task?

I wrote an ant task to run my project in NetBeans (I'm using a freeform java project). 我编写了一个Ant任务来在NetBeans中运行我的项目(我正在使用自由格式的Java项目)。 Now I want to write a debug task. 现在,我想编写一个调试任务。 The debug task is nearly identical to the run task except for a few added properties. 除增加了一些属性外,调试任务与运行任务几乎相同。 Can I subclass the run task and add in the extra properties? 我可以对运行任务进行子类化并添加其他属性吗?

Since an Ant task implementation is a Java class, Ant tasks may be subclassed just like any other Java class. 由于Ant任务实现是Java类,因此Ant任务可以像其他任何Java类一样被子类化。 However, the usual method for testing tasks is to write both JUnit and AntUnit tests. 但是,测试任务的常用方法是编写JUnitAntUnit测试。

For examples, take a look at the Apache Ant source code under tests . 例如,看一下test下的Apache Ant源代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM