Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Maven/Artifactory from keeping Snapshots with timestamps

Tags:

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!

like image 980
Pablojim Avatar asked Aug 07 '09 08:08

Pablojim


People also ask

How does Maven integrate with Artifactory?

Once you have created your Maven repository, go to Application | Artifactory | Artifacts, select your Maven repository and click Set Me Up. In the Set Me Up dialog, click Generate Maven Settings. You can now specify the repositories you want to configure for Maven.

How does Maven snapshot work?

A Maven snapshot is a special version of a Maven package that refers to the latest production branch code. It is a development version that precedes the final release version. You can identify a snapshot version of a Maven package by the suffix SNAPSHOT that is appended to the package version.

What is a snapshot Artifactory?

Maven Snapshot Version Behavior Artifactory supports centralized control of how snapshots are deployed into a repository, regardless of end user-specific settings. This can be used to guarantee a standardized format for deployed snapshots within your organization.

What is snapshot repo?

Snapshots are defined as artifacts that whose version ends in “-SNAPSHOT” in other word… Release repositories hold releases and Snapshot repositories hold snapshots. In maven a snapshot is defined as an artifact with a version ending in -SNAPSHOT. When deployed, the snapshot is turned into a timestamp.


1 Answers

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.

like image 67
Rich Seller Avatar answered Sep 23 '22 14:09

Rich Seller