Apache Ant - Portability

Portability

One of the primary aims of Ant was to solve make's portability problem. In a Makefile the actions required to create a target are specified as shell commands which are specific to the platform Make runs on. Different platforms require different shell commands. Ant solves this problem by providing a large amount of built-in functionality that is supposed to behave the same on all platforms.

For example, in the sample build.xml file above the clean target deletes the classes directory and everything in it. In a Makefile this would typically be done with the command:

rm -rf classes/

rm is a Unix-specific command unavailable in some other environments. Microsoft Windows, for example, would use:

rmdir /S /Q classes

In an Ant build file the same thing would be accomplished using a built-in command:

A common difference between platforms is the symbol used to delimit elements of file system directory path components. Unix uses a forward slash (/) to delimit components whereas Windows uses a backslash (\). Ant build files let authors choose their favorite convention: forward slash or backslash for directories; semicolon or colon for path separators. It converts each to the symbol appropriate to the platform on which it executes.

Read more about this topic:  Apache Ant