- Ant Tutorial
- Ant Useful Resources
1.0 ANT AN Time Sync; 1.0 ANT AN Using the SimulANT+ Library for Simulating ANT+ Devices in C#; 1.0 ANT AN Recording Bike Power Data; 1.0 ANT AN Getting Started with ANT PC Development; 1.0 ANT AN Over the Air Firmware Updates using ANT-FS; 1.0 ANT AN Clock Drift Test; 1.0 ANT AN FIT Globs; 1.2 ANT AN AutoANT Scripts; 1.0 ANT AN RSSI Extended. Download apache-ant-zip-1.8.0.jar. Apache-ant/apache-ant-zip-1.8.0.jar.zip( 39 k) The download jar file contains the following class files or Java source files.
- Selected Reading
Typically, Ant's build file, called build.xml should reside in the base directory of the project. However there is no restriction on the file name or its location. You are free to use other file names or save the build file in some other location.
For this exercise, create a file called build.xml anywhere in your computer with the following contents in it −
Note that there should be no blank line(s) or whitespace(s) before the xml declaration. If you allow them, the following error message occurs while executing the ant build -
The processing instruction target matching '[xX][mM][lL]' is not allowed.
All build files require the project element and at least one target element.
The XML element project has three attributes −
Sr.No. | Attributes & Description |
---|---|
1 | name The Name of the project. (Optional) |
2 | default The default target for the build script. A project may contain any number of targets. This attribute specifies which target should be considered as the default. (Mandatory) |
3 | basedir The base directory (or) the root folder for the project. (Optional) |
A target is a collection of tasks that you want to run as one unit. In our example, we have a simple target to provide an informational message to the user.
Targets can have dependencies on other targets. For example, a deploy target may have a dependency on the package target, the package target may have a dependency on the compile target and so forth. Dependencies are denoted using the depends attribute. For example −
The target element has the following attributes −
Sr.No. | Attributes & Description |
---|---|
1 | name The name of the target (Required) |
2 | depends Comma separated list of all targets that this target depends on. (Optional) |
3 | description A short description of the target. (optional) |
4 | if Allows the execution of a target based on the trueness of a conditional attribute. (optional) |
5 | unless Adds the target to the dependency list of the specified Extension Point. An Extension Point is similar to a target, but it does not have any tasks. (Optional) |
The echo task in the above example is a trivial task that prints a message. In our example, it prints the message Hello World.
Apache Ant 1.8.1 Download
To run the ant build file, open up command prompt and navigate to the folder where the build.xml resides, and type ant info. You could also type ant instead. Both will work, because info is the default target in the build file. You should see the following output −
- Ant Tutorial
Apache Ant 1.8 1 Download
- Ant Useful Resources
- Selected Reading
Typically, Ant's build file, called build.xml should reside in the base directory of the project. However there is no restriction on the file name or its location. You are free to use other file names or save the build file in some other location.
For this exercise, create a file called build.xml anywhere in your computer with the following contents in it −
Note that there should be no blank line(s) or whitespace(s) before the xml declaration. If you allow them, the following error message occurs while executing the ant build -
Ant 1.8 Download
The processing instruction target matching '[xX][mM][lL]' is not allowed.
All build files require the project element and at least one target element.
The XML element project has three attributes −
Sr.No. | Attributes & Description |
---|---|
1 | name The Name of the project. (Optional) |
2 | default The default target for the build script. A project may contain any number of targets. This attribute specifies which target should be considered as the default. (Mandatory) |
3 | basedir The base directory (or) the root folder for the project. (Optional) |
A target is a collection of tasks that you want to run as one unit. In our example, we have a simple target to provide an informational message to the user.
Targets can have dependencies on other targets. For example, a deploy target may have a dependency on the package target, the package target may have a dependency on the compile target and so forth. Dependencies are denoted using the depends attribute. For example −
The target element has the following attributes −
Sr.No. | Attributes & Description |
---|---|
1 | name The name of the target (Required) |
2 | depends Comma separated list of all targets that this target depends on. (Optional) |
3 | description A short description of the target. (optional) |
4 | if Allows the execution of a target based on the trueness of a conditional attribute. (optional) |
5 | unless Adds the target to the dependency list of the specified Extension Point. An Extension Point is similar to a target, but it does not have any tasks. (Optional) |
The echo task in the above example is a trivial task that prints a message. In our example, it prints the message Hello World.
To run the ant build file, open up command prompt and navigate to the folder where the build.xml resides, and type ant info. You could also type ant instead. Both will work, because info is the default target in the build file. You should see the following output −