@Experimental @Generated @ThreadSafe @Immutable public class Dependency extends Object implements Serializable, InputLocationTracker
<dependency> element contains information about a dependency
of the project.| Modifier and Type | Class and Description |
|---|---|
static class |
Dependency.Builder
Builder class used to create Dependency instances.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getArtifactId()
The unique id for an artifact produced by the project group, e.g.
|
String |
getClassifier()
The classifier of the dependency.
|
List<Exclusion> |
getExclusions()
Lists a set of artifacts that should be excluded from this dependency's
artifact list when it comes to calculating transitive dependencies.
|
String |
getGroupId()
The project group that produced the dependency, e.g.
|
InputLocation |
getLocation(Object key)
Gets the location of the specified field in the input source.
|
String |
getManagementKey() |
String |
getOptional()
Indicates the dependency is optional for use of this library.
|
String |
getScope()
The scope of the dependency -
compile, runtime,
test, system, and provided. |
String |
getSystemPath()
FOR SYSTEM SCOPE ONLY.
|
String |
getType()
The type of dependency, that will be mapped to a file extension, an optional classifier, and a few other attributes.
|
String |
getVersion()
The version of the dependency, e.g.
|
boolean |
isOptional() |
static Dependency.Builder |
newBuilder()
Creates a new
Dependency builder instance. |
static Dependency.Builder |
newBuilder(boolean withDefaults)
Creates a new
Dependency builder instance using default values or not. |
static Dependency.Builder |
newBuilder(Dependency from)
Creates a new
Dependency builder instance using the specified object as a basis. |
static Dependency.Builder |
newBuilder(Dependency from,
boolean forceCopy)
Creates a new
Dependency builder instance using the specified object as a basis. |
static Dependency |
newInstance()
Creates a new
Dependency instance. |
static Dependency |
newInstance(boolean withDefaults)
Creates a new
Dependency instance using default values or not. |
String |
toString() |
Dependency.Builder |
with()
Creates a new builder with this object as the basis.
|
Dependency |
withArtifactId(String artifactId)
Creates a new
Dependency instance using the specified artifactId. |
Dependency |
withClassifier(String classifier)
Creates a new
Dependency instance using the specified classifier. |
Dependency |
withExclusions(Collection<Exclusion> exclusions)
Creates a new
Dependency instance using the specified exclusions. |
Dependency |
withGroupId(String groupId)
Creates a new
Dependency instance using the specified groupId. |
Dependency |
withOptional(String optional)
Creates a new
Dependency instance using the specified optional. |
Dependency |
withScope(String scope)
Creates a new
Dependency instance using the specified scope. |
Dependency |
withSystemPath(String systemPath)
Creates a new
Dependency instance using the specified systemPath. |
Dependency |
withType(String type)
Creates a new
Dependency instance using the specified type. |
Dependency |
withVersion(String version)
Creates a new
Dependency instance using the specified version. |
public String getGroupId()
org.apache.maven.Stringpublic String getArtifactId()
maven-artifact.Stringpublic String getVersion()
3.2.1. In Maven 2, this can also be
specified as a range of versions.Stringpublic String getType()
jar, war, ejb-client
and test-jar: see default
artifact handlers for a list. New types can be defined by extensions, so this is not a complete list.Stringpublic String getClassifier()
sources and javadoc:
see default artifact handlers for a list,jdk14 and jdk15.Stringpublic String getScope()
compile, runtime,
test, system, and provided. 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 is compile.Stringpublic String getSystemPath()
${java.home}.String@Nonnull public List<Exclusion> getExclusions()
List<Exclusion>public String getOptional()
String for technical reasons, the semantic type is actually
Boolean. Default value is false.Stringpublic InputLocation getLocation(Object key)
getLocation in interface InputLocationTracker@Nonnull public Dependency.Builder with()
Builder@Nonnull public Dependency withGroupId(String groupId)
Dependency instance using the specified groupId.groupId - the new String to useDependency with the specified groupId@Nonnull public Dependency withArtifactId(String artifactId)
Dependency instance using the specified artifactId.artifactId - the new String to useDependency with the specified artifactId@Nonnull public Dependency withVersion(String version)
Dependency instance using the specified version.version - the new String to useDependency with the specified version@Nonnull public Dependency withType(String type)
Dependency instance using the specified type.type - the new String to useDependency with the specified type@Nonnull public Dependency withClassifier(String classifier)
Dependency instance using the specified classifier.classifier - the new String to useDependency with the specified classifier@Nonnull public Dependency withScope(String scope)
Dependency instance using the specified scope.scope - the new String to useDependency with the specified scope@Nonnull public Dependency withSystemPath(String systemPath)
Dependency instance using the specified systemPath.systemPath - the new String to useDependency with the specified systemPath@Nonnull public Dependency withExclusions(Collection<Exclusion> exclusions)
Dependency instance using the specified exclusions.exclusions - the new Collection<Exclusion> to useDependency with the specified exclusions@Nonnull public Dependency withOptional(String optional)
Dependency instance using the specified optional.optional - the new String to useDependency with the specified optional@Nonnull public static Dependency newInstance()
Dependency instance.
Equivalent to newInstance( true ).DependencynewInstance(boolean)@Nonnull public static Dependency newInstance(boolean withDefaults)
Dependency instance using default values or not.
Equivalent to newBuilder( withDefaults ).build().withDefaults - the boolean indicating whether default values should be usedDependency@Nonnull public static Dependency.Builder newBuilder()
Dependency builder instance.
Equivalent to newBuilder( true ).BuildernewBuilder(boolean)@Nonnull public static Dependency.Builder newBuilder(boolean withDefaults)
Dependency builder instance using default values or not.withDefaults - the boolean indicating whether default values should be usedBuilder@Nonnull public static Dependency.Builder newBuilder(Dependency from)
Dependency builder instance using the specified object as a basis.
Equivalent to newBuilder( from, false ).from - the Dependency instance to use as a basisBuilder@Nonnull public static Dependency.Builder newBuilder(Dependency from, boolean forceCopy)
Dependency builder instance using the specified object as a basis.from - the Dependency instance to use as a basisforceCopy - the boolean indicating if a copy should be forcedBuilderpublic boolean isOptional()
public String toString()
toString in class ObjectObject.toString()public String getManagementKey()
groupId:artifactId:typeCopyright © 2001–2022 The Apache Software Foundation. All rights reserved.