Apache Ant Basename Task

This task is used to get the basename of a specified file.

It sets specified property to the value of the last path element of the specified file. If the executed file is a directory, the basename will be the last directory element. It returns basename as a simple file name if the file is a full-path or relative-path without any directory elements.

Basename Task Attributes

AttributeDescriptionRequired
fileThe path to take the basenameYes
propertyThe name of the property.Yes
suffixIt is a suffix to remove from the resulting basename.No

Apache Ant Basename Task Example

Set Jar to a property by specifying file location.





Latest Courses