Class Basename

  extended by
      extended by
          extended by
All Implemented Interfaces:

public class Basename
extends Task

Sets a property to the base name of a specified file, optionally minus a suffix. This task can accept the following attributes:

The file and property attributes are required. The suffix attribute can be specified either with or without the ".", and the result will be the same (ie., the returned file name will be minus the .suffix).

When this task executes, it will set the specified property to the value of the last element in the specified file. If file is a directory, the basename will be the last directory element. If file is a full-path filename, the basename will be the simple file name. If a suffix is specified, and the specified file ends in that suffix, the basename will be the simple file name without the suffix.

Ant 1.5

Field Summary
Fields inherited from class
target, taskName, taskType, wrapper
Fields inherited from class
description, location, project
Constructor Summary
Method Summary
 void execute()
          do the work
 void setFile( file)
          file or directory to get base name from
 void setProperty(java.lang.String property)
          Property to set base name to.
 void setSuffix(java.lang.String suffix)
          Optional suffix to remove from base name.
Methods inherited from class
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
Methods inherited from class
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Basename()
Method Detail


public void setFile( file)
file or directory to get base name from

file - file or directory to get base name from


public void setProperty(java.lang.String property)
Property to set base name to.

property - name of property


public void setSuffix(java.lang.String suffix)
Optional suffix to remove from base name.

suffix - suffix to remove from base name


public void execute()
             throws BuildException
do the work

execute in class Task
BuildException - if required attributes are not supplied property and attribute are required attributes