commonDeveloper
commonDeveloper

Reputation: 21

Is it best practise to store snapshot versions in Artifactory in maven applications?

Is it best practise to store snapshot versions in Artifactory in maven applications? As snapshot versions should be used only for development purposes.

Upvotes: 1

Views: 1955

Answers (2)

J Fabian Meier
J Fabian Meier

Reputation: 35795

A SNAPSHOT version is meant to be used for development. You can store it in Artifactory, but for using an artifact productively, you should build a release version.

@Stanislav is right that timestamped SNAPSHOTs could technically be used like release versions, and I believe him that this works, but I wouldn't do it because it is not how SNAPSHOTs and releases were meant to be.

Upvotes: 0

Stanislav Bashkyrtsev
Stanislav Bashkyrtsev

Reputation: 15308

It's not true that SNAPSHOT versions should be used only for development. When SNAPSHOT version is uploaded it's not uploaded as is - it gets transformed into a unique version, something like this: 1-20150904.140213-59. When referencing such dependency you can:

  • either use SNAPSHOT word like 1-SNAPSHOT, then you don't really know which exact version is used
  • or use a resolved version: 1-20150904.140213-59

Using the 1st option is discouraged for any purpose - be it a deployment, or a <dependency> in pom.xml (even for development purposes), because it leads to non-repeatable actions. You run build once - you get a dependency with version 1-20150904.140213-59 downloaded, you run it for the 2nd time you may get another version like 1-20150904.140214-60.

But there's nothing wrong with referencing the full (resolved) version. So you can leverage snapshots the same way you do with release versions. Note though that remote repositories (e.g. Nexus) can be configured to delete old snapshot versions - so you need to take this into consideration.

By the way, snapshots are very convenient for releases.

Upvotes: 2

Related Questions