Package hudson.maven
Class ModuleDependency
java.lang.Object
hudson.maven.ModuleDependency
- All Implemented Interfaces:
Serializable
group id + artifact id + version and a flag to know if it's a plugin
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Stringfinal Stringstatic final StringWhen a plugin dependency is specified without giving a version, the semantics of that is the latest released plugin.final booleanstatic final StringFor compatibility reason, this value may be used in the verion field to indicate that the version is unknown.final StringVersion, possibly a version range. -
Constructor Summary
ConstructorsConstructorDescriptionModuleDependency(ModuleName name, String version) ModuleDependency(ModuleName name, String version, boolean plugin) ModuleDependency(String groupId, String artifactId, String version) ModuleDependency(String groupId, String artifactId, String version, boolean plugin) ModuleDependency(String groupId, String artifactId, String version, String scope, String type, String classifier, boolean plugin) ModuleDependency(org.apache.maven.model.Dependency dep) ModuleDependency(org.apache.maven.model.Extension ext) ModuleDependency(org.apache.maven.model.Plugin p) ModuleDependency(org.apache.maven.model.ReportPlugin p) ModuleDependency(org.apache.maven.project.MavenProject project) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(ModuleDependency other) Checks whether this ModuleDependency is satisfied by the dependency of the given ModuleDependency.booleanfindHighestFrom(Collection<ModuleDependency> candidates) Given a list of ModuleDependencies (of the same groupId and artifactId), picks theModuleDependencythat satisfies the constraint and has the highest version.getName()org.apache.maven.artifact.versioning.VersionRangeinthashCode()booleanReturns true if the version specification is a version range per maven version range syntax.org.apache.maven.artifact.versioning.ArtifactVersionprotected ObjectUpon reading from the disk, intern strings.toString()Returns groupId+artifactId plus unknown version.
-
Field Details
-
groupId
-
artifactId
-
version
Version, possibly a version range. -
plugin
public final boolean plugin- Since:
- 1.395
-
UNKNOWN
For compatibility reason, this value may be used in the verion field to indicate that the version is unknown.- See Also:
-
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 theModuleDependencyversion to becomeUNKNOWN, which would match any builds of the plugin.So we use this constant to indicate a version, and this will not match anything.
-
-
Constructor Details
-
ModuleDependency
-
ModuleDependency
-
ModuleDependency
-
ModuleDependency
-
ModuleDependency
-
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 Details
-
getName
-
withUnknownVersion
Returns groupId+artifactId plus unknown version. -
equals
-
hashCode
public int hashCode() -
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
Upon reading from the disk, intern strings. -
contains
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
Given a list of ModuleDependencies (of the same groupId and artifactId), picks theModuleDependencythat 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
-