Mklink Task

## Mklink

Since Apache Ant 1.10.16.

### Description

Creates hardlinks, junctions and symbolic links on the windows platform.

The task is just a wrapper around mklink and performs a few sanity checks but will not catch all restrictions like hardlinks or junctions not crossing volume boundaries.

In order to create symbolic links you need the "create symbolic link" permission - this can be achieved by enabling developer mode on the machine running Ant, running Ant with elevated permissions (which sounds like a bad idea) or enable the permission explicitly for oyur user.

### Parameters

Attribute | Description | Required
--- | --- | ---
linkType | The type of link to create, may be file-symlink, dir-symlink, hardlink or junction. | Yes unless targetFile is given in which case it defaults to file-symlink or dir-symlink depending on whether the target is a plain file or a directory.
link | The name of the link to be created, will be resolved relativ to the project's basedir. | Yes
targetFile | The resource the link should point to, will be resolved relativ to the project's basedir. | Exactly one of targetFile and targetText must be given.
targetText | The resource the link should point to. This will be passed to mklink verbatim. | Exactly one of targetFile and targetText must be given.
overwrite | Overwrite existing files or not. If overwrite is set to true, then any existing file, specified by the link attribute, will be overwritten irrespective of whether or not the existing file is a link. otherwise and existing file is considered an error and make the task fail. | No; defaults to false

### Examples

Make a hardlink named `foo` to a resource named `bar.foo` in `subdir`:

    <mklink link="${dir.top}/foo" targetFile="${dir.top}/subdir/bar.foo" linktype="hardlink"/>