views:

951

answers:

4

Hi,

Due to disk space considerations I'd like to only ever keep one version of any snapshot in my repository. Rather than keeping multiple versions with timestamp suffixes

e.g. ecommerce-2.3-20090806.145007-1.ear

How can I set this up? Is this a build setting or repository (Artifactory) setting

Thanks!

+3  A: 

The simplest (and recommended) way is to use non-unique snapshots. If you must use unique snapshots, you can do this in Artifactory by specifying the <maxUniqueSnapshots> property on the <localRepository> definition in artifactory.config.xml

For example:

<localRepository>
  <key>snapshots</key>
  <blackedOut>false</blackedOut>
  <handleReleases>false</handleReleases>
  <handleSnapshots>true</handleSnapshots>
  <maxUniqueSnapshots>1</maxUniqueSnapshots>
  <includesPattern>**/*</includesPattern>
  <snapshotVersionBehavior>non-unique</snapshotVersionBehavior>
</localRepository>

For reference you can do this in Nexus (via the UI) by setting up a scheduled service, it allows you to specify the minimum number to retain, the maximum period to retain them for, and whether to remove the snapshot if a release version is deployed.

Rich Seller
Thanks Rich - Artifactory seems to also allow you to change these values through the gui - it's just not too well documented!
Pablojim
If you have a reference to any relevant docs, can you add it to your answer
Rich Seller
using the non-unique snapshots is generally bad practice as it makes it very difficult to trace conflicts down to developer machines. You're much better off keeping the timestamps and using Nexus to clean up the old snapshots.
Brian Fox
+3  A: 

Just add somthing to my own question:

Adding

<distributionManagement>
    ...
    <snapshotRepository>
        ...
        <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
    ...
</distributionManagement>

To my parent pom also contributed to the solution of this. See:

http://i-proving.ca/space/Jessamyn+Smith/blog/2008-06-16_1

To alter the unique settings on the repository in Artifactory - log in as an admin - and select edit on the relevant repo - screenshot here:

http://wiki.jfrog.org/confluence/display/RTF/Understanding+Repositories

Pablojim
A: 

Using non-unique snapshots is not a good way to go. Instead get a repository manager that can clean up snapshots and configure that to keep disk space down. Having the timestamped snapshots makes it much easier to track down issues since you can easily see which version actually is being used.

Brian Fox
+1  A: 

Artifactory can clean up old unique snapshots. However, we have found unique snapshots to be non-useful for the purpose of tracking down dependencies or rolling-back to a specific version. There are better alternatives for doing this, which are cleaner and more reliable. That is why Artifactory defaults to prefer non-unique snapshots, and this policy can be centrally controlled (which is unique to Artifactory). You can read more about this, as well as the auto-cleanup feature here.