Class DependencyEntry


  • public class DependencyEntry
    extends java.lang.Object
    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
    • Field Detail

      • groupId

        private java.lang.String groupId
      • artifactId

        private java.lang.String artifactId
      • version

        private java.lang.String version
      • scope

        private java.lang.String scope
      • type

        private java.lang.String type
      • classifier

        private java.lang.String classifier
      • optional

        private java.lang.Boolean optional
    • Constructor Detail

      • DependencyEntry

        public DependencyEntry()
      • DependencyEntry

        public DependencyEntry​(java.lang.String groupId,
                               java.lang.String artifactId)
    • Method Detail

      • parse

        public static DependencyEntry parse​(java.lang.String gav)
        Parses a colon-separated coordinate string following Maven conventions.

        Supported formats:

        • groupId:artifactId — minimum
        • groupId:artifactId:version
        • groupId:artifactId:extension:version
        • groupId:artifactId:extension:classifier:version
        Parameters:
        gav - the coordinate string
        Returns:
        the parsed coordinates
        Throws:
        java.lang.IllegalArgumentException - if the string has fewer than 2 or more than 5 segments
      • validate

        public void validate()
        Validates that required fields are present.
        Throws:
        java.lang.IllegalArgumentException - if groupId or artifactId is missing
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getGroupId

        public java.lang.String getGroupId()
      • setGroupId

        public void setGroupId​(java.lang.String groupId)
      • getArtifactId

        public java.lang.String getArtifactId()
      • setArtifactId

        public void setArtifactId​(java.lang.String artifactId)
      • getVersion

        public java.lang.String getVersion()
      • setVersion

        public void setVersion​(java.lang.String version)
      • getScope

        public java.lang.String getScope()
      • setScope

        public void setScope​(java.lang.String scope)
      • getType

        public java.lang.String getType()
      • setType

        public void setType​(java.lang.String type)
      • getClassifier

        public java.lang.String getClassifier()
      • setClassifier

        public void setClassifier​(java.lang.String classifier)
      • getOptional

        public java.lang.Boolean getOptional()
      • setOptional

        public void setOptional​(java.lang.Boolean optional)