Is there any way to get the next version when publishing to a repository in gradle?
For e.g. if I have the version 3.0.1
in my repository I want the published version to be 3.0.2
.
ivy
has a task for ant
named buildnumber
which does exactly that:
<project xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <target name="ivyBuildNumber" description="Use ivy get the next build number"> <ivy:buildnumber resolver="url-chain" organisation="${ivy.organisation}" module="${ivy.module}" revision="${version.base}"/> <echoproperties prefix="ivy.new."/> </target>
Is there a way to do so in gradle
? if not how can I access ivy
tasks from gradle's ant
?
In my build.gradle
I calling to the ant
ant.importBuild 'build.xml'
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With