Class Dependency
java.lang.Object
org.apache.maven.model.Dependency
- All Implemented Interfaces:
Serializable
The
<dependency> element contains
information about a dependency
of the project.- Version:
- $Revision$ $Date$
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExclusion(Exclusion exclusion) Method addExclusion.Get the unique id for an artifact produced by the project group, e.g.Get the classifier of the dependency.Method getExclusions.Get the project group that produced the dependency, e.g.getScope()Get the scope of the dependency -compile,runtime,test,system, andprovided.Get fOR SYSTEM SCOPE ONLY.getType()Get the type of dependency.Get the version of the dependency, e.g.booleanGet indicates the dependency is optional for use of this library.voidremoveExclusion(Exclusion exclusion) Method removeExclusion.voidsetArtifactId(String artifactId) Set the unique id for an artifact produced by the project group, e.g.voidsetClassifier(String classifier) Set the classifier of the dependency.voidsetExclusions(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.voidsetGroupId(String groupId) Set the project group that produced the dependency, e.g.voidsetOptional(boolean optional) Set indicates the dependency is optional for use of this library.voidSet the scope of the dependency -compile,runtime,test,system, andprovided.voidsetSystemPath(String systemPath) Set fOR SYSTEM SCOPE ONLY.voidSet the type of dependency.voidsetVersion(String version) Set the version of the dependency, e.g.toString()
-
Constructor Details
-
Dependency
public Dependency()
-
-
Method Details
-
addExclusion
Method addExclusion.- Parameters:
exclusion- a exclusion object.
-
getArtifactId
Get the unique id for an artifact produced by the project group, e.g.maven-artifact.- Returns:
- 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,jdk14andjdk15.- Returns:
- String
-
getExclusions
-
getGroupId
Get the project group that produced the dependency, e.g.org.apache.maven.- Returns:
- 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
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
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-clientandtest-jar. New types can be defined by plugins that setextensionstotrue, so this is not a complete list.- Returns:
- 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
Method removeExclusion.- Parameters:
exclusion- a exclusion object.
-
setArtifactId
Set the unique id for an artifact produced by the project group, e.g.maven-artifact.- Parameters:
artifactId- a artifactId object.
-
setClassifier
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,jdk14andjdk15.- Parameters:
classifier- a classifier object.
-
setExclusions
-
setGroupId
Set the project group that produced the dependency, e.g.org.apache.maven.- Parameters:
groupId- a groupId object.
-
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- a optional object.
-
setScope
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- a scope object.
-
setSystemPath
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- a systemPath object.
-
setType
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-clientandtest-jar. New types can be defined by plugins that setextensionstotrue, so this is not a complete list.- Parameters:
type- a type object.
-
setVersion
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- a version object.
-
toString
-
getManagementKey
- Returns:
- the management key as
groupId:artifactId:type
-