How to get the next build number in Gradle

Yes, you can access ivy tasks from the ant script by importing ant's build.xml file to gradle's build.gradle file. Following is the syntax to do so.

ant.importBuild 'build.xml'

Please refer : https://docs.gradle.org/current/userguide/ant.html#sec:import_ant_build


I don't think there is support in Gradle, but you can try to use the Ant task. https://docs.gradle.org/current/userguide/ant.html#sec:import_ant_build

Another way to do this is to use some sort of plugin, or customized task for managing the version.

  • Plugin: https://github.com/researchgate/gradle-release
  • Custom task: https://www.tikalk.com/devops/increment-version-numbers-in-gradle/

I recommend you to use ResearchGate release plugin https://github.com/researchgate/gradle-release It has a pretty documentation. Easy to read. Also, check out how I used it in my personal project. https://github.com/vatolinrp/bitcoin-esb/blob/master/build.gradle It would be a nice example for you.

Tags:

Java

Ant

Ivy

Gradle