Class DependencyEntry
java.lang.Object
org.apache.maven.plugins.dependency.pom.DependencyEntry
Represents parsed Maven dependency coordinates (GAV + scope/type/classifier).
Supports parsing from a colon-separated string in the format:
groupId:artifactId[:version] or
groupId:artifactId[:extension[:classifier]]:version.
This follows the standard Maven coordinate convention used by
org.eclipse.aether.artifact.DefaultArtifact. Scope and optional
are not part of coordinates and must be specified as separate parameters.
Design note: This class exists because no single class on the
classpath covers all requirements. DefaultArtifact (Aether) provides GAV
parsing but requires a version (throws on g:a) and lacks scope/optional.
Dependency (maven-model) has all fields but no coordinate string parser.
This class bridges both: it parses g:a (needed by dependency:remove)
and carries scope/optional.
- Since:
- 3.11.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetScope()getType()static DependencyEntryParses a colon-separated coordinate string following Maven conventions.voidsetArtifactId(String artifactId) voidsetClassifier(String classifier) voidsetGroupId(String groupId) voidsetOptional(Boolean optional) voidvoidvoidsetVersion(String version) toString()voidvalidate()Validates that required fields are present.
-
Constructor Details
-
DependencyEntry
public DependencyEntry() -
DependencyEntry
-
-
Method Details
-
parse
Parses a colon-separated coordinate string following Maven conventions.Supported formats:
groupId:artifactId— minimumgroupId:artifactId:versiongroupId:artifactId:extension:versiongroupId:artifactId:extension:classifier:version
- Parameters:
gav- the coordinate string- Returns:
- the parsed coordinates
- Throws:
IllegalArgumentException- if the string has fewer than 2 or more than 5 segments
-
validate
public void validate()Validates that required fields are present.- Throws:
IllegalArgumentException- if groupId or artifactId is missing
-
toString
-
getGroupId
-
setGroupId
-
getArtifactId
-
setArtifactId
-
getVersion
-
setVersion
-
getScope
-
setScope
-
getType
-
setType
-
getClassifier
-
setClassifier
-
getOptional
-
setOptional
-