Package org.apache.maven.model.v3_0_0
Class Dependency
- java.lang.Object
-
- org.apache.maven.model.v3_0_0.Dependency
-
- All Implemented Interfaces:
Serializable
public class Dependency extends Object implements Serializable
The<dependency>element contains information about a dependency of the project.- Version:
- $Revision$ $Date$
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Dependency()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProperty(String key, String value)Method addProperty.booleanequals(Object o)StringgetArtifact()StringgetArtifactDirectory()StringgetArtifactId()Get the unique id for an artifact produced by the project group, e.g.StringgetExtension()StringgetGroupId()Get the project group that produced the dependency, e.g.StringgetId()Get Deprecated.StringgetJar()Get literal name of the artifact in the repository.StringgetKey()PropertiesgetProperties()Method getProperties.StringgetProperty(String property)StringgetType()Get the type of dependency.StringgetTypeDirectory()StringgetUrl()Get this url will be provided to the user if the jar file cannot be downloaded from the central repository.StringgetVersion()Get the version of the dependency, e.g.inthashCode()booleanisAddedToClasspath()booleanisPlugin()voidsetArtifactId(String artifactId)Set the unique id for an artifact produced by the project group, e.g.voidsetGroupId(String groupId)Set the project group that produced the dependency, e.g.voidsetId(String id)Set Deprecated.voidsetJar(String jar)Set literal name of the artifact in the repository.voidsetProperties(Properties properties)Set properties about the dependency.voidsetType(String type)Set the type of dependency.voidsetUrl(String url)Set this url will be provided to the user if the jar file cannot be downloaded from the central repository.voidsetVersion(String version)Set the version of the dependency, e.g.StringtoString()
-
-
-
Method Detail
-
addProperty
public void addProperty(String key, String value)
Method addProperty.- Parameters:
key-value-
-
getArtifactId
public String getArtifactId()
Get the unique id for an artifact produced by the project group, e.g.maven-artifact.- Returns:
- String
-
getGroupId
public String getGroupId()
Get the project group that produced the dependency, e.g.org.apache.maven.- Returns:
- String
-
getId
public String getId()
Get Deprecated. Please usegroupIdandartifactIdtogether instead.- Returns:
- String
-
getJar
public String getJar()
Get literal name of the artifact in the repository. Used to override the calculated artifact name.- Returns:
- String
-
getProperties
public Properties getProperties()
Method getProperties.- Returns:
- Properties
-
getType
public String getType()
Get the type of dependency. This defaults tojar. While it usually represents the extension on the filename of the dependency, that is not always the case. Some examples arejar,war, andplugin. A dependency of typepluginis loaded as a Maven plugin and not added to the project build classpath.- Returns:
- String
-
getUrl
public String getUrl()
Get this url will be provided to the user if the jar file cannot be downloaded from the central repository.- Returns:
- String
-
getVersion
public String getVersion()
Get the version of the dependency, e.g.3.2.1. In Maven 2, this can also be specified as a range of versions.- Returns:
- String
-
setArtifactId
public void setArtifactId(String artifactId)
Set the unique id for an artifact produced by the project group, e.g.maven-artifact.- Parameters:
artifactId-
-
setGroupId
public void setGroupId(String groupId)
Set the project group that produced the dependency, e.g.org.apache.maven.- Parameters:
groupId-
-
setId
public void setId(String id)
Set Deprecated. Please usegroupIdandartifactIdtogether instead.- Parameters:
id-
-
setJar
public void setJar(String jar)
Set literal name of the artifact in the repository. Used to override the calculated artifact name.- Parameters:
jar-
-
setProperties
public void setProperties(Properties properties)
Set properties about the dependency. Various plugins allow you to mark dependencies with properties. For example the war plugin looks for awar.bundleproperty, and if found will include the dependency inWEB-INF/lib.- Parameters:
properties-
-
setType
public void setType(String type)
Set the type of dependency. This defaults tojar. While it usually represents the extension on the filename of the dependency, that is not always the case. Some examples arejar,war, andplugin. A dependency of typepluginis loaded as a Maven plugin and not added to the project build classpath.- Parameters:
type-
-
setUrl
public void setUrl(String url)
Set this url will be provided to the user if the jar file cannot be downloaded from the central repository.- Parameters:
url-
-
setVersion
public void setVersion(String version)
Set the version of the dependency, e.g.3.2.1. In Maven 2, this can also be specified as a range of versions.- Parameters:
version-
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
getKey
public String getKey()
- Returns:
- the key as
id:type
-
getArtifactDirectory
public String getArtifactDirectory()
- Returns:
- the groupId as artifact directory
-
getArtifact
public String getArtifact()
- Returns:
- the artifact name as
artifactId-version.extensionif <jar/> not set
-
getTypeDirectory
public String getTypeDirectory()
-
getExtension
public String getExtension()
-
isAddedToClasspath
public boolean isAddedToClasspath()
-
isPlugin
public boolean isPlugin()
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classObject- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject- See Also:
Object.hashCode()
-
-