Package org.apache.maven.model
Class Dependency
- java.lang.Object
-
- org.apache.maven.model.Dependency
-
- All Implemented Interfaces:
java.io.Serializable
public class Dependency extends java.lang.Object implements java.io.Serializable
The<dependency>
element contains information about a dependency of the project.- Version:
- $Revision$ $Date$
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
artifactId
The unique id for an artifact produced by the project group, e.g.private java.lang.String
classifier
The classifier of the dependency.private java.util.List<Exclusion>
exclusions
Field exclusions.private java.lang.String
groupId
The project group that produced the dependency, e.g.private boolean
optional
Indicates the dependency is optional for use of this library.private java.lang.String
scope
The scope of the dependency -compile
,runtime
,test
,system
, andprovided
.private java.lang.String
systemPath
FOR SYSTEM SCOPE ONLY.private java.lang.String
type
The type of dependency.private java.lang.String
version
The version of the dependency, e.g.
-
Constructor Summary
Constructors Constructor Description Dependency()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExclusion(Exclusion exclusion)
Method addExclusion.java.lang.String
getArtifactId()
Get the unique id for an artifact produced by the project group, e.g.java.lang.String
getClassifier()
Get the classifier of the dependency.java.util.List<Exclusion>
getExclusions()
Method getExclusions.java.lang.String
getGroupId()
Get the project group that produced the dependency, e.g.java.lang.String
getManagementKey()
java.lang.String
getScope()
Get the scope of the dependency -compile
,runtime
,test
,system
, andprovided
.java.lang.String
getSystemPath()
Get fOR SYSTEM SCOPE ONLY.java.lang.String
getType()
Get the type of dependency.java.lang.String
getVersion()
Get the version of the dependency, e.g.boolean
isOptional()
Get indicates the dependency is optional for use of this library.void
removeExclusion(Exclusion exclusion)
Method removeExclusion.void
setArtifactId(java.lang.String artifactId)
Set the unique id for an artifact produced by the project group, e.g.void
setClassifier(java.lang.String classifier)
Set the classifier of the dependency.void
setExclusions(java.util.List<Exclusion> exclusions)
Set lists a set of artifacts that should be excluded from this dependency's artifact list when it comes to calculating transitive dependencies.void
setGroupId(java.lang.String groupId)
Set the project group that produced the dependency, e.g.void
setOptional(boolean optional)
Set indicates the dependency is optional for use of this library.void
setScope(java.lang.String scope)
Set the scope of the dependency -compile
,runtime
,test
,system
, andprovided
.void
setSystemPath(java.lang.String systemPath)
Set fOR SYSTEM SCOPE ONLY.void
setType(java.lang.String type)
Set the type of dependency.void
setVersion(java.lang.String version)
Set the version of the dependency, e.g.java.lang.String
toString()
-
-
-
Field Detail
-
groupId
private java.lang.String groupId
The project group that produced the dependency, e.g.org.apache.maven
.
-
artifactId
private java.lang.String artifactId
The unique id for an artifact produced by the project group, e.g.maven-artifact
.
-
version
private java.lang.String version
The version of the dependency, e.g.3.2.1
. In Maven 2, this can also be specified as a range of versions.
-
type
private java.lang.String type
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. A type can be mapped to a different extension and a classifier. The type often correspongs to the packaging used, though this is also not always the case. Some examples arejar
,war
,ejb-client
andtest-jar
. New types can be defined by plugins that setextensions
totrue
, so this is not a complete list.
-
classifier
private java.lang.String classifier
The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but were built differently, and is appended to the filename after the version. For example,jdk14
andjdk15
.
-
scope
private java.lang.String scope
The scope of the dependency -compile
,runtime
,test
,system
, andprovided
. Used to calculate the various classpaths used for compilation, testing, and so on. It also assists in determining which artifacts to include in a distribution of this project. For more information, see the dependency mechanism.
-
systemPath
private java.lang.String systemPath
FOR SYSTEM SCOPE ONLY. Note that use of this property is discouraged and may be replaced in later versions. This specifies the path on the filesystem for this dependency. Requires an absolute path for the value, not relative. Use a property that gives the machine specific absolute path, e.g.${java.home}
.
-
exclusions
private java.util.List<Exclusion> exclusions
Field exclusions.
-
optional
private boolean optional
Indicates the dependency is optional for use of this library. While the version of the dependency will be taken into account for dependency calculation if the library is used elsewhere, it will not be passed on transitively.
-
-
Method Detail
-
addExclusion
public void addExclusion(Exclusion exclusion)
Method addExclusion.- Parameters:
exclusion
-
-
getArtifactId
public java.lang.String getArtifactId()
Get the unique id for an artifact produced by the project group, e.g.maven-artifact
.- Returns:
- String
-
getClassifier
public java.lang.String getClassifier()
Get the classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but were built differently, and is appended to the filename after the version. For example,jdk14
andjdk15
.- Returns:
- String
-
getExclusions
public java.util.List<Exclusion> getExclusions()
Method getExclusions.- Returns:
- List
-
getGroupId
public java.lang.String getGroupId()
Get the project group that produced the dependency, e.g.org.apache.maven
.- Returns:
- String
-
getScope
public java.lang.String getScope()
Get the scope of the dependency -compile
,runtime
,test
,system
, andprovided
. Used to calculate the various classpaths used for compilation, testing, and so on. It also assists in determining which artifacts to include in a distribution of this project. For more information, see the dependency mechanism.- Returns:
- String
-
getSystemPath
public java.lang.String getSystemPath()
Get fOR SYSTEM SCOPE ONLY. Note that use of this property is discouraged and may be replaced in later versions. This specifies the path on the filesystem for this dependency. Requires an absolute path for the value, not relative. Use a property that gives the machine specific absolute path, e.g.${java.home}
.- Returns:
- String
-
getType
public java.lang.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. A type can be mapped to a different extension and a classifier. The type often correspongs to the packaging used, though this is also not always the case. Some examples arejar
,war
,ejb-client
andtest-jar
. New types can be defined by plugins that setextensions
totrue
, so this is not a complete list.- Returns:
- String
-
getVersion
public java.lang.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
-
isOptional
public boolean isOptional()
Get indicates the dependency is optional for use of this library. While the version of the dependency will be taken into account for dependency calculation if the library is used elsewhere, it will not be passed on transitively.- Returns:
- boolean
-
removeExclusion
public void removeExclusion(Exclusion exclusion)
Method removeExclusion.- Parameters:
exclusion
-
-
setArtifactId
public void setArtifactId(java.lang.String artifactId)
Set the unique id for an artifact produced by the project group, e.g.maven-artifact
.- Parameters:
artifactId
-
-
setClassifier
public void setClassifier(java.lang.String classifier)
Set the classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but were built differently, and is appended to the filename after the version. For example,jdk14
andjdk15
.- Parameters:
classifier
-
-
setExclusions
public void setExclusions(java.util.List<Exclusion> exclusions)
Set lists a set of artifacts that should be excluded from this dependency's artifact list when it comes to calculating transitive dependencies.- Parameters:
exclusions
-
-
setGroupId
public void setGroupId(java.lang.String groupId)
Set the project group that produced the dependency, e.g.org.apache.maven
.- Parameters:
groupId
-
-
setOptional
public void setOptional(boolean optional)
Set indicates the dependency is optional for use of this library. While the version of the dependency will be taken into account for dependency calculation if the library is used elsewhere, it will not be passed on transitively.- Parameters:
optional
-
-
setScope
public void setScope(java.lang.String scope)
Set the scope of the dependency -compile
,runtime
,test
,system
, andprovided
. Used to calculate the various classpaths used for compilation, testing, and so on. It also assists in determining which artifacts to include in a distribution of this project. For more information, see the dependency mechanism.- Parameters:
scope
-
-
setSystemPath
public void setSystemPath(java.lang.String systemPath)
Set fOR SYSTEM SCOPE ONLY. Note that use of this property is discouraged and may be replaced in later versions. This specifies the path on the filesystem for this dependency. Requires an absolute path for the value, not relative. Use a property that gives the machine specific absolute path, e.g.${java.home}
.- Parameters:
systemPath
-
-
setType
public void setType(java.lang.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. A type can be mapped to a different extension and a classifier. The type often correspongs to the packaging used, though this is also not always the case. Some examples arejar
,war
,ejb-client
andtest-jar
. New types can be defined by plugins that setextensions
totrue
, so this is not a complete list.- Parameters:
type
-
-
setVersion
public void setVersion(java.lang.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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
getManagementKey
public java.lang.String getManagementKey()
- Returns:
- the management key as
groupId:artifactId:type
-
-