Tutorials Navigation
Apache Ant Tutorial - Extending Ant
Tutorial Name: Apache Ant Tutorial - Extending Ant
Category: PC Tutorials
Submitted By: hoot
Date Added:
Comments: 0
Views: 271
Related Forum: PC Building Forum
Share:
Ant comes with a predefined set of tasks, however you can create your own tasks, as shown in the example below.
Custom Ant Tasks should extend the org.apache.tools.ant.Task class and should extend the execute() method. Below is a simple example
package com.example.ant;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
public class MyTask extends Task {
String message;
public void execute() throws BuildException {
log("Message: " + message, Project.MSG_INFO);
}
public void setMessage(String message) {
this.message = message;
}
}
To execute the custom task, you need to add the following to the Hello World Fax web application
<target name = "custom">
<taskdef name = "custom" classname = "com.example.ant.MyTask" />
<custom message = "Hello World!"/>
</target>
Executing the above custom task prints the message 'Hello World!'
c:\>ant custom
test:
[custom] Message : Hello World!
elapsed: 0.2 sec
BUILD PASSED
This is just a simple example, you can use the power of Ant to do whatever you want to improve your build and deployment process.
Ratings
Comments
Related Tutorials
- 01. Emulating Xbox 360 on PC for Running COD4 With Mods(3,760)
- 02. How to: Matrix Numbers | Batch File(1,973)
- 03. How to Password Protect Files on Windows(880)
- 04. How to play Socom 2/3/ and Combined Assault on PC(6,993)
- 05. Modern Warfare 2 Vac Ban Bypass Tutorial(6,315)
- 06. How to embed an image on TheTechGame(3,160)
- 07. [PC] NIOH 2 OTHER USER SAVE RESIGN(13,125)
- 08. Host bot lobbies! Full Tutorial!(11,740)
- 09. Unban yourself [Plutonium BO2](14,348)
- 10. Fall Guys - How to Change Your Name Color on Fall Guys(8,429)
- 11. Best Crosshair Settings for Valorant(6,574)
- 12. Othercide The Surgeon Boss Guide(2,584)
- 13. Othercide Remembrances Unlock Guide(4,545)
- 14. Othercide Beginners Tips and Tricks(2,754)
- 15. How to Fix Grounded Crashes, Loading Time, Low FPS and Other(4,911)
"Apache Ant Tutorial - Extending Ant" :: Login/Create an Account :: 0 comments