Build numbers and Ivy publishing versions

I’m publishing Ivy artifacts to an Artifactory repository, and (as I understand it) Ivy won’t let you publish an artifact twice with the same version number unless you specify that you want to overwrite the existing copy of the file. Is there a recommended way to append the build number (or maybe a timestamp) to the version number that you use when publishing to Ivy, so that previous builds’ artifacts are still available?

Thanks.

The way you shape your version number is pretty much up to your project’s needs. For example you could have something like this: [major-version].[minor-version].[build-number].

I’d add the dynamic portion of your artifact version at build time to the version property. For example if you’d want to add the timestamp you could do something like this:

version = "1.0.${new Date().getTime()}"

Another option might be using Artifactory’s ability to convert non-unique snapshots to unique ones.

That means that you can deploy all your snapshots under ‘1.0-SNAPSHOT’ and they will be automatically converted to unique snapshots (with timestamp) during the deployment to Artifactory.