1

I'm using the gradle-release-plugin successfully in jenkins with the option gradle.release.useAutomaticVersion=true; however, it is incrementing the incremental and i'd like to increment the minor....

1.14.0 want to increment to 1.15.0, rather than 1.14.1

is there a way to do this?

J Vipe
  • 39
  • 1
  • 5

1 Answers1

0

You can configure how the increment should work.

release {
    versionPatterns = [
        /(\d+)\.(\d+)\.(\d)$/: { Matcher m, Project p -> m.replaceAll("${m[0][1]}.${(m[0][2] as int) +1}.${m[0][3]}") }
    ]
}

I think this should do the trick. It should match your current version via the regex pattern

/(\d+)\.(\d+)\.(\d)$/

And writes the new version by

m.replaceAll("${m[0][1]}.${(m[0][2] as int) +1}.${m[0][3]}")

where the second group is incremented by 1

Didn't tested the code

Hillkorn
  • 633
  • 4
  • 12
  • 1
    Perfect. The below worked for me: /[.]*\.(\d+)\.(\d+)[.]*/: { Matcher m, Project p -> m.replaceAll(".${(m[0][1] as int) + 1}.0") } I – J Vipe Jan 31 '19 at 14:18