本文整理汇总了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);
}
}
}