DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Base Directory Name And Path Manipulation In Apache Ant

  • submit to reddit
        // The following will provide you an outline of basedirectory name and path in Apache Ant

    Author : Debadatta Mishra
    Description : This ant script provides the followings.
    1. Full path of the base directory.
    2. Root or parent path of the base directory.
    3. Only Directory name of the base diectory.
<project name="basedirnametest" basedir="." default="test">

 <basename property=””     file=”${basedir}”/>
 <property name=””        value=”${}” /> 
 <dirname property=”antfile.dir”       file=”${basedir}”/> <!– Provides Root Path –>
    <target name=”test”>
        <echo>Base Directory Path : ${basedir}</echo>
     <echo>Base Directory Parent Path : ${antfile.dir}</echo>
     <echo>Base Directory only Name : ${}</echo>