本文整理匯總了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();
}
}