Apache ANT Tasks Tutorial
Selected Reading
- Ant Tasks - Discussion
- Ant Tasks - Useful Resources
- Ant Tasks - Quick Guide
- ANT Tasks -JAR
- ANT Tasks - Zip
- ANT Tasks - WAR
- ANT Tasks - Sleep
- ANT Tasks - Move
- ANT Tasks - MkDir
- ANT Tasks - LoadFile
- ANT Tasks - Length
- ANT Tasks - Javac
- ANT Tasks - Java
- ANT Tasks - Import
- ANT Tasks - Fail
- ANT Tasks - EAR
- ANT Tasks - Delete
- ANT Tasks - Copy
- ANT Tasks - Condition
- ANT Tasks - Concat
- ANT Tasks - Chmod
- ANT Tasks - GUnzip
- ANT Tasks - GZip
- ANT Tasks - BaseName
- ANT Tasks - Environment Setup
- ANT Tasks - Introduction
- ANT Tasks - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
ANT Tasks - Import
Apache Ant Tasks - Import
Description
Import task imports another build file into the project.
Properties
Sr.No | Attributes & Description |
---|---|
1 | File The file to import. If this is a relative file name, the file name will be resolved relative to the importing file. Note: this is unpke most other Ant file attributes, where relative files are resolved relative to basedir. |
2 | Optional If true, do not stop the build if the file does not exist. |
3 | As Specifies the prefix prepended to the target names. |
4 | prefixSeparator Specifies the separator to be used between the prefix and the target name. |
Example
Usage
Create build.xml with the following content −
<?xml version="1.0"?> <project name="TutorialPoint" default="info"> <import file="nested.xml" as="nested"/> <target name="info" depends="nested.echo"> </target> </project>
And a nested.xml with the following content −
<project> <target name="setUp"> <property name="build.dir" value="build"/> </target> <target name="echo" depends="setUp"> <echo>build.dir is set as build</echo> </target> </project>
Above script will create an ear file in the current directory as myapp.ear.
Output
Running Ant on the above build file produces the following output −
F: utorialspointant>ant Buildfile: F: utorialspointantuild.xml setUp: nested.echo: [echo] build.dir is set as build info: BUILD SUCCESSFUL Total time: 0 secondsAdvertisements