org.netbeans.modules.project.ant/1 1.42.1

org.netbeans.api.project.ant
Class AntBuildExtender

java.lang.Object
  extended by org.netbeans.api.project.ant.AntBuildExtender

public final class AntBuildExtender
extends Object

Allows extending the project's build script with 3rd party additions. Check the Project's lookup to see if the feature is supported by a given Ant project type. Typical usage:

Please note that it's easy to break the build script functionality and any script extensions shall be done with care. A few rules to follow:

Since:
org.netbeans.modules.project.ant 1.16

Nested Class Summary
 class AntBuildExtender.Extension
          Describes and allows to manipulate the build script extension and it's links to the main build script of the project.
 
Field Summary
static String ANT_CUSTOMTASKS_LIBS_PROPNAME
           
 
Method Summary
 AntBuildExtender.Extension addExtension(String id, FileObject extensionXml)
          Adds a new build script extension.
 void addLibrary(Library library)
          Copies global library to the shared library folder of the project if the project is sharable and adds library name to the list of libraries needed to run Ant script.
 List<String> getExtensibleTargets()
          Get a list of target names in the main build script that are allowed to be extended by adding the "depends" attribute definition to them.
 AntBuildExtender.Extension getExtension(String id)
          Get an extension by the id.
 void removeExtension(String id)
          Remove an existing build script extension.
 void removeLibrary(Library library)
          Removes library name from the list of libraries needed to run Ant script
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANT_CUSTOMTASKS_LIBS_PROPNAME

public static final String ANT_CUSTOMTASKS_LIBS_PROPNAME
See Also:
Constant Field Values
Method Detail

getExtensibleTargets

public List<String> getExtensibleTargets()
Get a list of target names in the main build script that are allowed to be extended by adding the "depends" attribute definition to them.

Returns:
list of target names

addExtension

public AntBuildExtender.Extension addExtension(String id,
                                               FileObject extensionXml)
Adds a new build script extension.

Parameters:
id - identification of the extension
extensionXml - fileobject referencing the build script for the extension, needs to be located in nbproject directory or below.
Returns:
the newly created extension.

removeExtension

public void removeExtension(String id)
Remove an existing build script extension. Make sure to remove the extension's script file before/after removing the extension.

Parameters:
id - identification of the extension

getExtension

public AntBuildExtender.Extension getExtension(String id)
Get an extension by the id.

Parameters:
id - identification token
Returns:
Extention with the given id or null if not found.

addLibrary

public void addLibrary(Library library)
                throws IOException
Copies global library to the shared library folder of the project if the project is sharable and adds library name to the list of libraries needed to run Ant script. In the case of non-sharable project only the name is added to the list and the library is copied when the project is made sharable.

Parameters:
library - global library to be copied to shared library folder of the project
Throws:
IOException - exception thrown when properties cannot be loaded or saved
Since:
org.netbeans.modules.project.ant/1 1.23

removeLibrary

public void removeLibrary(Library library)
                   throws IOException
Removes library name from the list of libraries needed to run Ant script

Parameters:
library - either global or shared library to be removed from list of libraries needed for running Ant script; cannot be null
Throws:
IOException - exception thrown when properties cannot be loaded or saved
Since:
org.netbeans.modules.project.ant/1 1.23

org.netbeans.modules.project.ant/1 1.42.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.