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:
ModuleName
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description String
artifactId
String
groupId
static String
NONE
When a plugin dependency is specified without giving a version, the semantics of that is the latest released plugin.boolean
plugin
static String
UNKNOWN
For compatibility reason, this value may be used in the verion field to indicate that the version is unknown.String
version
Version, possibly a version range.
-
Constructor Summary
Constructors Constructor Description ModuleDependency(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(ModuleDependency other)
Checks whether this ModuleDependency is satisfied by the dependency of the given ModuleDependency.boolean
equals(Object o)
ModuleDependency
findHighestFrom(Collection<ModuleDependency> candidates)
Given a list of ModuleDependencies (of the same groupId and artifactId), picks theModuleDependency
that satisfies the constraint and has the highest version.ModuleName
getName()
org.apache.maven.artifact.versioning.VersionRange
getVersionAsRange()
int
hashCode()
boolean
isVersionRange()
Returns true if the version specification is a version range per maven version range syntax.org.apache.maven.artifact.versioning.ArtifactVersion
parseVersion()
protected Object
readResolve()
Upon reading from the disk, intern strings.String
toString()
ModuleDependency
withUnknownVersion()
Returns groupId+artifactId plus unknown version.
-
-
-
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 theModuleDependency
version 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.
- See Also:
ModuleDependency(Plugin)
, Constant Field Values
-
-
Constructor Detail
-
ModuleDependency
public ModuleDependency(String groupId, String artifactId, String version, boolean plugin)
-
ModuleDependency
public ModuleDependency(String groupId, String artifactId, String version, String scope, String type, String classifier, 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
-
getName
public ModuleName getName()
-
withUnknownVersion
public ModuleDependency withUnknownVersion()
Returns groupId+artifactId plus unknown version.
-
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 theModuleDependency
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.
-
-