本文整理匯總了Java中org.apache.maven.artifact.versioning.VersionRange.containsVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java VersionRange.containsVersion方法的具體用法?Java VersionRange.containsVersion怎麽用?Java VersionRange.containsVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.artifact.versioning.VersionRange
的用法示例。
在下文中一共展示了VersionRange.containsVersion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLatestReleaseVersion
import org.apache.maven.artifact.versioning.VersionRange; //導入方法依賴的package包/類
/**
* Returns the latest published release artifact version in the version range,
* or null if there is no such version.
*/
public ArtifactVersion getLatestReleaseVersion(
String groupId, String artifactId, VersionRange range) {
String coordinates = idToKey(groupId, artifactId);
try {
NavigableSet<ArtifactVersion> versions = availableVersions.get(coordinates);
for (ArtifactVersion version : versions.descendingSet()) {
if (isReleased(version)) {
if (range == null || range.containsVersion(version)) {
return version;
}
}
}
} catch (ExecutionException ex) {
logger.log(
Level.WARNING,
"Could not retrieve version for artifact " + coordinates,
ex.getCause());
}
return null;
}
示例2: ensureEngineIsInstalled
import org.apache.maven.artifact.versioning.VersionRange; //導入方法依賴的package包/類
private void ensureEngineIsInstalled() throws MojoExecutionException
{
VersionRange ivyVersionRange = getIvyVersionRange();
if (identifyAndGetEngineDirectory() == null)
{
handleNoInstalledEngine();
}
else
{
if (engineDirectoryIsEmpty())
{
getRawEngineDirectory().mkdirs();
}
ArtifactVersion installedEngineVersion = getInstalledEngineVersion(getRawEngineDirectory());
if (installedEngineVersion == null ||
!ivyVersionRange.containsVersion(installedEngineVersion))
{
handleWrongIvyVersion(installedEngineVersion);
}
}
}