Package hudson.maven

Class ModuleDependency

    • Field Detail

      • groupId

        public final String groupId
      • artifactId

        public final String artifactId
      • version

        public final String version
        Version, possibly a version range.
      • plugin

        public final boolean plugin
        Since:
        1.395
      • UNKNOWN

        public static final String UNKNOWN
        For compatibility reason, this value may be used in the verion field to indicate that the version is unknown.
        See Also:
        Constant Field Values
      • NONE

        public static final String NONE
        When a plugin dependency is specified without giving a version, the semantics of that is the latest released plugin. In this case, we don't want the ModuleDependency version to become UNKNOWN, which would match any builds of the plugin.

        So we use this constant to indicate a version, and this will not match anything.

        See Also:
        ModuleDependency(Plugin), Constant Field Values
    • Constructor Detail

      • ModuleDependency

        public ModuleDependency​(String groupId,
                                String artifactId,
                                String version)
      • ModuleDependency

        public ModuleDependency​(String groupId,
                                String artifactId,
                                String version,
                                boolean plugin)
      • ModuleDependency

        public ModuleDependency​(ModuleName name,
                                String version)
      • ModuleDependency

        public ModuleDependency​(ModuleName name,
                                String version,
                                boolean plugin)
      • ModuleDependency

        public ModuleDependency​(org.apache.maven.model.Dependency dep)
      • ModuleDependency

        public ModuleDependency​(org.apache.maven.project.MavenProject project)
      • ModuleDependency

        public ModuleDependency​(org.apache.maven.model.Plugin p)
      • ModuleDependency

        public ModuleDependency​(org.apache.maven.model.ReportPlugin p)
      • ModuleDependency

        public ModuleDependency​(org.apache.maven.model.Extension ext)
    • Method Detail

      • withUnknownVersion

        public ModuleDependency withUnknownVersion()
        Returns groupId+artifactId plus unknown version.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isVersionRange

        public boolean isVersionRange()
        Returns true if the version specification is a version range per maven version range syntax.
        Returns:
        true if version specification is a range.
      • getVersionAsRange

        public org.apache.maven.artifact.versioning.VersionRange getVersionAsRange()
                                                                            throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
        Throws:
        org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
      • parseVersion

        public org.apache.maven.artifact.versioning.ArtifactVersion parseVersion()
      • readResolve

        protected Object readResolve()
        Upon reading from the disk, intern strings.
      • contains

        public boolean contains​(ModuleDependency other)
        Checks whether this ModuleDependency is satisfied by the dependency of the given ModuleDependency. If the version string is a defined version, then it does a comparison. If the version string is a version range if parses this and caters for this.
        Parameters:
        other - The dependency to check for.
        Returns:
        true if contained false otherwise.
      • findHighestFrom

        public ModuleDependency findHighestFrom​(Collection<ModuleDependency> candidates)
        Given a list of ModuleDependencies (of the same groupId and artifactId), picks the ModuleDependency that satisfies the constraint and has the highest version.
        Parameters:
        candidates - List that represents specific (non-range) versions.
        Returns:
        The highest satisfying ModuleDependency or null if none can be found.