This is a simple example that illustrates how to find the basedir name, file name, project name, ant version, java version, operating system name, ant home directory name, java home directory name, user home directory name and user name. Ant provides you with certain built-in properties that you may find useful during your build process. The following table shows the property name and it’s description.
Â
Ant’s built-in properties:
Property                                                             Description
Â
ant.file                                                                The absolute path of the build file
Â
ant.project.name                                          The name of the project as set in the <project> element’s name attribute.
Â
ant.home                                                           The root directory of ant
Â
ant.version                                                       The version of this ant installation. This is not just the version number and includes information such as the compilation date.
Â
ant.java.version                                              The version of the java that ant uses
Â
basedir                                                               The absolute path of the project
Â
os.name                                                             Operating system name
Â
java.home                                                         Java home directory name
Â
user.home                                                         User directory name
Â
user.name                                                         User name                        Â
Â
Â
Example Program:
<?xml version=”1.0″?>
Â
<project name=”AntProperties” default=”echo” basedir=”.”>
Â
 <target name=”echo”>
 <echo message=”The operating system is: ${os.name}”/>Â
Â
 <!– absolute path of the project. –>
 <echo message=”The home path is: ${basedir}”/>
Â
 <!– absolute path of the build file. –>
 <echo message=”The file name is: ${ant.file}”/>
Â
 <!– root directory of ant. –>
 <echo message=”The Project name is: ${ant.project.name}”/>
 <echo message=”The Ant home directory is: ${ant.home}”/>
 <echo message=”The Ant version is: ${ant.version}”/>
 <echo message=”The Java version is: ${ant.java.version}”/>
Â
 <!– System properties. –>
 <echo message=”The Java home directory is: ${java.home}”/>
 <echo message=”The User home directory is: ${user.home}”/>
 <echo message=”The User name is: ${user.name}”/>
 </target>
Â
</project>
Â
- How to Choose Wireless Access Points for Office - December 13, 2024
- Online Real Estate Courses: Navigating the Shift to Digital Education - December 13, 2024
- From Concept to Implementation: IoT Services Redefining Modern Solutions - December 13, 2024