站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.1

AntArtifact (NetBeans Ant Project API) - NetBeans API Javadoc 5.5.1

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

org.netbeans.api.project.ant
Class AntArtifact

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

public abstract class AntArtifact
extends Object

Represents one artifact of an Ant build. For example, if a build script is known to generate a JAR of a certain name as a result of running a certain target, this object will name that JAR and point to the script and target responsible for creating it. You can use this information to add an <ant> task to another project which will generate that JAR as a dependency before using it.

See Also:
SimpleAntArtifact

Constructor Summary
protected AntArtifact()
          Empty constructor for use from subclasses.
 
Method Summary
 FileObject getArtifactFile()
          Deprecated. use getArtifactFiles() instead
 FileObject[] getArtifactFiles()
          Convenience method to find the actual artifacts, if they currently exist.
 URI getArtifactLocation()
          Deprecated. use getArtifactLocations() instead
 URI[] getArtifactLocations()
          Get the locations of the build artifacts relative to the Ant script.
abstract  String getCleanTargetName()
          Get the name of an Ant target that will delete this artifact.
 String getID()
          Returns identifier of the AntArtifact which must be unique within one project.
 Project getProject()
          Find the project associated with this script, if any.
 Properties getProperties()
          Optional properties which are used for Ant target execution.
 FileObject getScriptFile()
          Convenience method to find the actual script file, if it currently exists.
abstract  File getScriptLocation()
          Get a location for the Ant script that is able to produce this artifact.
abstract  String getTargetName()
          Get the name of the Ant target that is able to produce this artifact.
abstract  String getType()
          Get the type of the build artifact.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntArtifact

protected AntArtifact()
Empty constructor for use from subclasses.

Method Detail

getType

public abstract String getType()
Get the type of the build artifact. This can refer to both the physical content type or format; and to the intended category of usage. Typically a given client (e.g. superproject) will be interested in only a certain artifact type for a certain purpose, e.g. inclusion in a Java classpath.

Particular type identifiers should be agreed upon between providers and clients. For example, JavaProjectConstants.ARTIFACT_TYPE_JAR is defined for JAR outputs. Others may be defined as needed; for example, tag library JARs, WARs, EJB JARs, deployment descriptor fragments, etc. XXX format - NMTOKEN maybe

Returns:
the type (format or usage) of the build artifact

getScriptLocation

public abstract File getScriptLocation()
Get a location for the Ant script that is able to produce this artifact. The name build.xml is conventional.

Returns:
the location of an Ant project file (might not currently exist)

getTargetName

public abstract String getTargetName()
Get the name of the Ant target that is able to produce this artifact. E.g. jar would be conventional for JAR artifacts.

Returns:
an Ant target name

getCleanTargetName

public abstract String getCleanTargetName()
Get the name of an Ant target that will delete this artifact. Typically this should be clean. The target may delete other build products as well.

Returns:
an Ant target name

getArtifactLocation

public URI getArtifactLocation()
Deprecated. use getArtifactLocations() instead

Get the location of the build artifact relative to the Ant script. See getArtifactLocations().

Returns:
a URI to the build artifact, resolved relative to getScriptLocation(); may be either relative, or an absolute file-protocol URI

getArtifactLocations

public URI[] getArtifactLocations()
Get the locations of the build artifacts relative to the Ant script. For example, dist/mylib.jar. The method is not defined as abstract only for backward compatibility reasons. It must be overridden. The order is important and should stay the same unless the artifact was changed.

Returns:
an array of URIs to the build artifacts, resolved relative to getScriptLocation(); may be either relative, or an absolute file-protocol URI
Since:
1.5

getID

public String getID()
Returns identifier of the AntArtifact which must be unique within one project. By default it is target name which produces the artifact, but if your target produces more that one artifact then you must override this method and uniquely identify each artifact.


getArtifactFile

public final FileObject getArtifactFile()
Deprecated. use getArtifactFiles() instead

Convenience method to find the actual artifact, if it currently exists. See getArtifactFiles().

Returns:
the artifact file on disk, or null if it could not be found

getArtifactFiles

public final FileObject[] getArtifactFiles()
Convenience method to find the actual artifacts, if they currently exist. Uses getScriptFile() or getScriptLocation() and resolves getArtifactLocations() from it. Note that a project which has been cleaned more recently than it has been built will generally not have the build artifacts on disk and so this call may easily return empty array. If you do not rely on the actual presence of the file but just need to refer to it abstractly, use getArtifactLocations() instead.

Returns:
the artifact files which exist on disk, or empty array if none could be found
Since:
1.5

getScriptFile

public final FileObject getScriptFile()
Convenience method to find the actual script file, if it currently exists. Uses getScriptLocation(). The script must exist on disk (Ant cannot run scripts from NetBeans filesystems unless they are represented on disk).

Returns:
the Ant build script file, or null if it could not be found

getProject

public Project getProject()
Find the project associated with this script, if any. The default implementation uses getScriptLocation() and FileOwnerQuery, but subclasses may override that to return something else.

Returns:
the associated project, or null if there is none or it could not be located

getProperties

public Properties getProperties()
Optional properties which are used for Ant target execution. Only properties necessary for customization of Ant target execution should be used. These properties are stored in project.xml of project using this artifact so care should be taken in defining what properties are used, e.g. never use absolute path like values

Since:
1.5

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

Built on March 26 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.