Package hudson.maven

Class ModuleDependency

java.lang.Object
hudson.maven.ModuleDependency
All Implemented Interfaces:
Serializable

public final class ModuleDependency extends Object implements Serializable
group id + artifact id + version and a flag to know if it's a plugin
Author:
Kohsuke Kawaguchi
See Also:
  • Field Details Link icon

    • groupId Link icon

      public final String groupId
    • artifactId Link icon

      public final String artifactId
    • version Link icon

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

      public final boolean plugin
      Since:
      1.395
    • UNKNOWN Link icon

      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:
    • NONE Link icon

      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:
  • Constructor Details Link icon

    • ModuleDependency Link icon

      public ModuleDependency(String groupId, String artifactId, String version)
    • ModuleDependency Link icon

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

      public ModuleDependency(String groupId, String artifactId, String version, String scope, String type, String classifier, boolean plugin)
    • ModuleDependency Link icon

      public ModuleDependency(ModuleName name, String version)
    • ModuleDependency Link icon

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

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

      public ModuleDependency(org.apache.maven.project.MavenProject project)
    • ModuleDependency Link icon

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

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

      public ModuleDependency(org.apache.maven.model.Extension ext)
  • Method Details Link icon

    • getName Link icon

      public ModuleName getName()
    • withUnknownVersion Link icon

      public ModuleDependency withUnknownVersion()
      Returns groupId+artifactId plus unknown version.
    • equals Link icon

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode Link icon

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

      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 Link icon

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

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

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

      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 Link icon

      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.
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object