Apache Ant Import Task
Import tasks is used to import a build file into the current project. The imported files are parsed by using ProjectHelper. The ProjectHelper is actually responsible for parsing the imported files.
The import task is a top level task so it can't be used inside target element. There are two functional aspects which are related to this task.
If a target in the current file is also available into the imported file, the current file's target will get precedence.
Imported files are local to the current main project. To distinguish between imported and local files, Ant adds a property which contains path to the imported build file.
Note: If the imported file does not contain name attribute, it property will not set.
Apache Ant Import Task Attributes
Apache Ant Import Task Example
The below code imports targets from the common-targets.xml file located into parent directory.
It imports a project
It imports target from the targets.xml file which is inside the common directory.