I've been trying to migrate an ant script to gradle and have so far not found gradle's counterpart to the ant <buildnumber/>
which is an auto-incrementing number used within the build process.
In your build script, a property called ant is provided by Gradle. This is a reference to an AntBuilder instance. This AntBuilder is used to access Ant tasks, types and properties from your build script. There is a very simple mapping from Ant's build.
Gradle doesn't have a counterpart to <buildnumber/>
, but you can always use the Ant task.
In case there are any other noobs out there like me that don't know how to execute ant targets and access their properties, here's an example:
jar.doFirst {
ant.buildnumber()
manifest {
attributes{
'Implementation-Version': ant.antProject.properties['build.number']
)
}
}
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