How to stop Maven/Artifactory from keeping Snapshots with timestamps

Pablojim picture Pablojim · Aug 7, 2009 · Viewed 40k times · Source

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!

Answer

Rich Seller picture Rich Seller · Aug 7, 2009

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.