[
https://issues.apache.org/jira/browse/MRELEASE-596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Elliotte Rusty Harold resolved MRELEASE-596.
--------------------------------------------
Resolution: Abandoned
> Enhance DefaultVersionInfo getNextVersion to increment version at specified
> index
> ----------------------------------------------------------------------------------
>
> Key: MRELEASE-596
> URL: https://issues.apache.org/jira/browse/MRELEASE-596
> Project: Maven Release Plugin
> Issue Type: New Feature
> Reporter: Prashant Bhate
> Priority: Major
> Fix For: Backlog
>
> Attachments: DefaultVersionInfo.java, DefaultVersionInfoTest.java
>
>
> Current DefaultVersionInfo always increment either annotationRevision if
> available or least version from digits. say if 1.2.3 would be incremented to
> 1.2.4 always.
> I am currently implementing fix for
> http://jira.codehaus.org/browse/MVERSIONS-124 which requires NextVersion with
> version incremented at specified index.
> Hence it would be good to include another method shown below that will
> increment annotationRevision if parameter index is -ve. Otherwise it would
> roll the digit at specified index and reset rest of the digits
> {code}
> /**
> * Increment version at specified index. While incrementing digits set
> * remaining segments to zero.
> *
> * @param index
> * If -ve increment annotationRevision else increment digits
> at
> * index and reset remaining to 0.
> * @return new instance of version info
> */
> public VersionInfo getNextVersion(int index) {
> DefaultVersionInfo version = null;
> if (digits != null) {
> List digits = new ArrayList(this.digits);
> String annotationRevision = this.annotationRevision;
> if (index < 0) {
> if (StringUtils.isNumeric(annotationRevision)) {
> annotationRevision =
> incrementVersionString(annotationRevision);
> }
> } else if (index < digits.size()) {
> int next = index;
> digits.set(next,
> incrementVersionString((String) digits
> .get(next)));
> for (int i = next + 1; i < digits.size(); i++) {
> digits.set(i, "0");
> }
> }
> version = new DefaultVersionInfo(digits, annotation,
> annotationRevision, buildSpecifier,
> annotationSeparator,
> annotationRevSeparator, buildSeparator);
> }
> return version;
> }
> {code}
> Request some one to validate this and schedule this for checkin if possible
> Regards,
> Prashant
--
This message was sent by Atlassian Jira
(v8.3.4#803005)