Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional.extension

public Class JarLibResolveTask

extends Task
Class Inheritance
Imports
java.io.File, java.util.ArrayList, .List, java.util.jar.Manifest, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.taskdefs.optional.extension.resolvers.AntResolver, .LocationResolver, .URLResolver

Tries to locate a JAR to satisfy an extension and place location of JAR into property.

Field Summary

Modifier and TypeField and Description
private boolean
checkExtension

Flag to indicate that you should check that the libraries resolved actually contain extension and if they don't then raise an exception.

private boolean
failOnError

Flag indicating whether or not you should throw a BuildException if you cannot resolve library.

private String
propertyName

The name of the property in which the location of library is stored.

private Extension
requiredExtension

The extension that is required.

private final List<ExtensionResolver>
resolvers

The set of resolvers to use to attempt to locate library.

Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addConfiguredAnt(final AntResolver
the AntResolver to generate the library.
ant
)

Adds Ant resolver to run an Ant build file to generate a library.

public void
addConfiguredExtension(final ExtensionAdapter
Set the Extension looking for.
extension
)

Set the Extension looking for.

public void
addConfiguredLocation(final LocationResolver
the resolver location to search.
loc
)

Adds location resolver to look for a library in a location relative to project directory.

public void
addConfiguredUrl(final URLResolver
the URL resolver from which to download the library
url
)

Adds a URL resolver to download a library from a URL to a local file.

private void
checkExtension(final File
the candidate library
file
)

Check if specified file satisfies extension.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the task.
private void
missingExtension()

Utility method that will throw a BuildException if failOnError is true else it just displays a warning.

public void
setCheckExtension(final boolean
if true, libraries returned by nested resolvers should be checked to see if they supply extension.
checkExtension
)

Check nested libraries for extensions

public void
setFailOnError(final boolean
if true, failure to locate library should fail build.
failOnError
)

Set whether to fail if error.

private void
setLibraryProperty(final File
the library
file
)

Utility method to set the appropriate property to indicate that specified file satisfies library requirements.

public void
setProperty(final String
The name of the property in which the location of library is stored.
property
)

The name of the property in which the location of library is stored.

private void
validate()

Validate the tasks parameters.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

checkExtensionback to summary
private boolean checkExtension

Flag to indicate that you should check that the libraries resolved actually contain extension and if they don't then raise an exception.

failOnErrorback to summary
private boolean failOnError

Flag indicating whether or not you should throw a BuildException if you cannot resolve library.

propertyNameback to summary
private String propertyName

The name of the property in which the location of library is stored.

requiredExtensionback to summary
private Extension requiredExtension

The extension that is required.

resolversback to summary
private final List<ExtensionResolver> resolvers

The set of resolvers to use to attempt to locate library.

Constructor Detail

JarLibResolveTaskback to summary
public JarLibResolveTask()

Method Detail

addConfiguredAntback to summary
public void addConfiguredAnt(final AntResolver ant)

Adds Ant resolver to run an Ant build file to generate a library.

Parameters
ant:AntResolver

the AntResolver to generate the library.

addConfiguredExtensionback to summary
public void addConfiguredExtension(final ExtensionAdapter extension)

Set the Extension looking for.

Parameters
extension:ExtensionAdapter

Set the Extension looking for.

addConfiguredLocationback to summary
public void addConfiguredLocation(final LocationResolver loc)

Adds location resolver to look for a library in a location relative to project directory.

Parameters
loc:LocationResolver

the resolver location to search.

addConfiguredUrlback to summary
public void addConfiguredUrl(final URLResolver url)

Adds a URL resolver to download a library from a URL to a local file.

Parameters
url:URLResolver

the URL resolver from which to download the library

checkExtensionback to summary
private void checkExtension(final File file)

Check if specified file satisfies extension. If it does then set the relevant property else throw a BuildException.

Parameters
file:File

the candidate library

Exceptions
BuildException:
if library does not satisfy extension
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Execute the task.

Annotations
@Override
Exceptions
BuildException:
if the task fails.
missingExtensionback to summary
private void missingExtension()

Utility method that will throw a BuildException if failOnError is true else it just displays a warning.

setCheckExtensionback to summary
public void setCheckExtension(final boolean checkExtension)

Check nested libraries for extensions

Parameters
checkExtension:boolean

if true, libraries returned by nested resolvers should be checked to see if they supply extension.

setFailOnErrorback to summary
public void setFailOnError(final boolean failOnError)

Set whether to fail if error.

Parameters
failOnError:boolean

if true, failure to locate library should fail build.

setLibraryPropertyback to summary
private void setLibraryProperty(final File file)

Utility method to set the appropriate property to indicate that specified file satisfies library requirements.

Parameters
file:File

the library

setPropertyback to summary
public void setProperty(final String property)

The name of the property in which the location of library is stored.

Parameters
property:String

The name of the property in which the location of library is stored.

validateback to summary
private void validate() throws BuildException

Validate the tasks parameters.

Exceptions
BuildException:
if invalid parameters found