I'm currently converting a ant build script with ivy dependency resolution and publishing to a gradle script.
However, although gradle integrates ivy, I have found nothing to simplify determine a version number. Let me first explain what we do currently with ant: read the current version number from a property file ..properties on a file server if the property file is not available, assume version 0.0.1 if the target publish_major is executed, increment the major version number and set minor/patch to 0, similar for publish_minor and publish_patch, otherwise append '-SNAPSHOT' to the current version number li>publish the files (gradle: uploadLibs) the same for the targets deliver_major, ... (gradle: uploadDists) increment the patch version number and save it to the property file Of course we can do this with gradle, too - it's even shorter than with ant. However, it needs to be in every gradle file (in ant it's in an include) and it could be much simpler. Here my proposal: In the init-Task of the Java plugin do the following, if the project.version is not yet set: get the latest version number for the current project module (project.group/project.name) from Ivy using the uploadResolver(s) from uploadLibs if no published version was found, assume 0.0.0 if the property 'major' is set, increment the major version number and set minor/patch to 0, similar for properties 'minor' and 'patch', otherwise if the current version is not a snapshot version, increment the patch number and add '-SNAPSHOT' (configurable?) to the version (this ensures that using 'latest.integration' as version in a dependency will really get the latest version) set project.version to the calculated value This should be quite easy to implement (if you know the Ivy-API) and would implement a default behavior which can easily be ignored (by setting the project.version manually). In any case, a method String Project.getLatestUploadedVersion() would definitely be very appreciated. Comments? Ideas to make it even more general? -- View this message in context: http://www.nabble.com/Version-numbers-tp20112226p20112226.html Sent from the gradle-user mailing list archive at Nabble.com.
