Makeurl Task

Description

This task takes one or more filenames and turns them into URLs, which it then assigns to a property. Useful when setting up RMI or JNLP codebases, for example. Nested filesets are supported; if present, these are turned into the URLs with the supplied separator between them.

Parameters

Attribute Description Type Required
file name of a file to be converted into a URL File No, if a nested fileset or path is supplied
property name of a property to set to the URL String Yes
separator separator for the multi-URL option String No; default is space
validate validate that every named file exists boolean No; default is true

Parameters as nested elements

fileset (org.apache.tools.ant.types.FileSet)

A fileset of JAR files to include in the URL list, each separated by the separator.

path (org.apache.tools.ant.types.Path)

Add a path to the URL. All elements in the path will be converted to individual URL entries.

Examples

Set the property m2.repository.url to the file: URL of the local Maven2 repository.

<makeurl file="${user.home}/.m2/repository" property="m2.repository.url"/>

Set the property codebase to the three URLs of the files provided as nested elements.

<makeurl property="codebase">
  <fileset dir="lib includes="*.jar"/>
</makeurl>