- ANT Tasks - Home
- ANT Tasks - Introduction
- ANT Tasks - Environment Setup
- Apache ANT Tasks Examples
- ANT Tasks - BaseName
- ANT Tasks - GZip
- ANT Tasks - GUnzip
- ANT Tasks - Chmod
- ANT Tasks - Concat
- ANT Tasks - Condition
- ANT Tasks - Copy
- ANT Tasks - Delete
- ANT Tasks - EAR
- ANT Tasks - Fail
- ANT Tasks - Import
- ANT Tasks - Java
- ANT Tasks - Javac
- ANT Tasks - Length
- ANT Tasks - LoadFile
- ANT Tasks - MkDir
- ANT Tasks - Move
- ANT Tasks - Sleep
- ANT Tasks - WAR
- ANT Tasks - Zip
- ANT Tasks -JAR
- Apache ANT Tasks Useful Resources
- Ant Tasks - Quick Guide
- Ant Tasks - Useful Resources
- Ant Tasks - Discussion
Apache Ant - Import Task
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 unlike 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:\tutorialspoint\ant>ant Buildfile: F:\tutorialspoint\ant\build.xml setUp: nested.echo: [echo] build.dir is set as build info: BUILD SUCCESSFUL Total time: 0 seconds
Advertisements