Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some good ways to distribute a common ant file to be included in builds?

I work in a group where we produce many small apps, and use ANT for our build processes.

We would like to have some of our commonly used directives housed in a common way. Currently, we require a mapped drive to a common location, and use

<import file="${env.MAPPED_DRIVE}/common_directive.xml">

There must be a better way to distribute a common ant file to include in many projects without having to map a drive. Do you have any other suggestions?

Import is a "top level" directive, which means it won't work inside of a target. Therefore, I cannot simply create a target that downloads the file, and then import it.

like image 523
nrobey Avatar asked Feb 26 '11 02:02

nrobey


People also ask

Which of the following files is used to maintain all the targets in Ant?

Ant uses an xml file for its configuration. The default file name is build. xml . Ant builds are based on three blocks: tasks, targets and extension points.

Where can I find Ant build file?

To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.


1 Answers

If you are using ANT 1.8+, you could specify a URL and host the common build fragment on a website.

Since Ant 1.8.0 the task can also import resources from URLs or classpath resources (which are URLs, really). If you need to know whether the current build file's source has been a file or an URL you can consult the property ant.file.type.projectname (using the same example as above ant.file.type.builddocs) which either have the value "file" or "url".

like image 173
Mads Hansen Avatar answered Sep 20 '22 10:09

Mads Hansen