Package org.apache.maven.model
Class Dependency
java.lang.Object
org.apache.maven.model.Dependency
- All Implemented Interfaces:
- Serializable,- Cloneable,- InputLocationTracker
The 
<dependency> element contains
 information about a dependency
         of the project.- Version:
- $Revision$ $Date$
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddExclusion(Exclusion exclusion) Method addExclusion.voidClears the management key in case one field has been modified.clone()Method clone.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.getLocation(Object key) Gets the location of the specified field in the input source.Get indicates the dependency is optional for use of this library.getScope()Get the scope of the dependency -compile,runtime,test,system, andprovided.Get fOR SYSTEM SCOPE ONLY.getType()Get the type of dependency, that will be mapped to a file extension, an optional classifier, and a few other attributes.Get the version of the dependency, e.g.booleanvoidremoveExclusion(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.voidsetLocation(Object key, InputLocation location) Sets the location of the specified field.voidsetOptional(boolean optional) voidsetOptional(String optional) Set indicates the dependency is optional for use of this library.voidsetOtherLocation(Object key, InputLocation location) voidSet the scope of the dependency -compile,runtime,test,system, andprovided.voidsetSystemPath(String systemPath) Set fOR SYSTEM SCOPE ONLY.voidSet the type of dependency, that will be mapped to a file extension, an optional classifier, and a few other attributes.voidsetVersion(String version) Set the version of the dependency, e.g.toString()
- 
Constructor Details- 
Dependencypublic Dependency()
 
- 
- 
Method Details- 
addExclusionMethod addExclusion.- Parameters:
- exclusion- a exclusion object.
 
- 
cloneMethod clone.
- 
getArtifactIdGet the unique id for an artifact produced by the project group, e.g.maven-artifact.- Returns:
- String
 
- 
getClassifierGet the classifier of the dependency. It is appended to the filename after the version. This allows:- referring to attached artifact, for example
 sourcesandjavadoc: see default artifact handlers for a list,
- distinguishing two artifacts
             that belong to the same POM but were built
 differently.
             For example, jdk14andjdk15.
 - Returns:
- String
 
- referring to attached artifact, for example
 
- 
getExclusionsMethod getExclusions.- Returns:
- List
 
- 
getGroupIdGet the project group that produced the dependency, e.g.org.apache.maven.- Returns:
- String
 
- 
getLocationDescription copied from interface:InputLocationTrackerGets the location of the specified field in the input source.- Specified by:
- getLocationin interface- InputLocationTracker
- Parameters:
- key- a key object.
- Returns:
- InputLocation
 
- 
getOptionalGet 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. Note: While the type of this field isStringfor technical reasons, the semantic type is actuallyBoolean. Default value isfalse.- Returns:
- String
 
- 
setLocationDescription copied from interface:InputLocationTrackerSets the location of the specified field.- Specified by:
- setLocationin interface- InputLocationTracker
- Parameters:
- key- a key object.
- location- a location object.
 
- 
setOtherLocation- Parameters:
- key- a key object.
- location- a location object.
 
- 
getScopeGet 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. The default scope iscompile.- Returns:
- String
 
- 
getSystemPathGet 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
 
- 
getTypeGet the type of dependency, that will be mapped to a file extension, an optional classifier, and a few other attributes. Some examples arejar,war,ejb-clientandtest-jar: see default artifact handlers for a list. New types can be defined by extensions, so this is not a complete list.- Returns:
- String
 
- 
getVersionGet 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
 
- 
removeExclusionMethod removeExclusion.- Parameters:
- exclusion- a exclusion object.
 
- 
setArtifactIdSet the unique id for an artifact produced by the project group, e.g.maven-artifact.- Parameters:
- artifactId- a artifactId object.
 
- 
setClassifierSet the classifier of the dependency. It is appended to the filename after the version. This allows:- referring to attached artifact, for example
 sourcesandjavadoc: see default artifact handlers for a list,
- distinguishing two artifacts
             that belong to the same POM but were built
 differently.
             For example, jdk14andjdk15.
 - Parameters:
- classifier- a classifier object.
 
- referring to attached artifact, for example
 
- 
setExclusionsSet lists a set of artifacts that should be excluded from this dependency's artifact list when it comes to calculating transitive dependencies.- Parameters:
- exclusions- a exclusions object.
 
- 
setGroupIdSet the project group that produced the dependency, e.g.org.apache.maven.- Parameters:
- groupId- a groupId object.
 
- 
setOptionalSet 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. Note: While the type of this field isStringfor technical reasons, the semantic type is actuallyBoolean. Default value isfalse.- Parameters:
- optional- a optional object.
 
- 
setScopeSet 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. The default scope iscompile.- Parameters:
- scope- a scope object.
 
- 
setSystemPathSet 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.
 
- 
setTypeSet the type of dependency, that will be mapped to a file extension, an optional classifier, and a few other attributes. Some examples arejar,war,ejb-clientandtest-jar: see default artifact handlers for a list. New types can be defined by extensions, so this is not a complete list.- Parameters:
- type- a type object.
 
- 
setVersionSet 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.
 
- 
isOptionalpublic boolean isOptional()
- 
setOptionalpublic void setOptional(boolean optional) 
- 
toString
- 
getManagementKey- Returns:
- the management key as groupId:artifactId:type
 
- 
clearManagementKeypublic void clearManagementKey()Clears the management key in case one field has been modified.
 
-