本文整理汇总了Java中org.apache.maven.shared.release.versions.DefaultVersionInfo类的典型用法代码示例。如果您正苦于以下问题:Java DefaultVersionInfo类的具体用法?Java DefaultVersionInfo怎么用?Java DefaultVersionInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultVersionInfo类属于org.apache.maven.shared.release.versions包,在下文中一共展示了DefaultVersionInfo类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNewVersion
import org.apache.maven.shared.release.versions.DefaultVersionInfo; //导入依赖的package包/类
@Override
protected String getNewVersion() throws MojoExecutionException, VersionParseException {
VersionInfo versionInfo = new DefaultVersionInfo(getOldVersion());
if (!addSnapshot && versionInfo.isSnapshot())
{
return versionInfo.getReleaseVersionString();
}
else if (addSnapshot && !versionInfo.isSnapshot())
{
return versionInfo.getSnapshotVersionString();
} else {
String message = addSnapshot ?
"Trying to add -SNAPSHOT to version that already contains it (" + getOldVersion() + ")"
:"Trying to remove -SNAPSHOT from version that does not contain it (" + getOldVersion() + ")";
throw new MojoExecutionException(message);
}
}
示例2: incrementVersion
import org.apache.maven.shared.release.versions.DefaultVersionInfo; //导入依赖的package包/类
/**
* Increment the version number.
*
* @param version
* @return
* @throws VersionParseException
*/
private String incrementVersion( String version ) throws VersionParseException {
VersionInfo versionInfo = new DefaultVersionInfo(version);
if (versionInfo.isSnapshot())
{
return versionInfo.getNextVersion().getSnapshotVersionString();
}
else
{
return versionInfo.getNextVersion().getReleaseVersionString();
}
}