Skip to main content

Maven SNAPSHOT Tasks

Delete SNAPSHOT Task

You can use the Delete SNAPSHOT task to delete SNAPSHOT components from a Maven repository based on their timestamps.

The task only removes timestamped versions within "-SNAPSHOT" version folders, which typically contain multiple SNAPSHOTs for the same SNAPSHOT version.

The Delete SNAPSHOT task can help you preserve storage space by removing SNAPSHOT versions that you no longer need to access after deploying a new SNAPSHOT. When you create the task, you can specify the following:

  • Repository on which to run the task.

  • Minimum snapshot count - the minimum number of snapshots to preserve per component SNAPSHOT version.

  • Snapshot retention (days) - delete all SNAPSHOT versions older than this number of days provided you still keep the minimum number specified in Minimum snapshot count.

  • Remove if released - check this if you want to remove all SNAPSHOT versions that match any released component found with the same groupId and artifactId coordinates.

    • This will take precedence over the number you selected in the Minimum snapshot count field.

  • Grace period after release (days) - the number of days before purging released SNAPSHOTs.

    • The task will not delete any released SNAPSHOTs that have timestamps that fall within the set grace period.


It is possible to configure this task in such a way that the results may be unexpected. For example, if you configure the task to keep 0 minimum SNAPSHOTs older than 0 days, it will delete all SNAPSHOTs whether or not you configured a grace period for releases.

The underlying soft-deleted blobs are permanently deleted using the strategy supported by the blobstore implementation.

Delete SNAPSHOT Task Example

For this example, say you have a folder named "1.3-SNAPSHOT" that contains three files with different timestamps:

  • artifact-1.3-20210226.143327-1.jar

  • artifact-1.3-20210226.172432-2.jar

  • artifact-1.3-20210227.102015-3.jar

You configure the Delete SNAPSHOT task with the following parameters:

  • Minimum snapshot count: 1

  • Snapshot retention (days): 0

  • Remove if released: unchecked

  • Grace period after release: 0

This configuration will leave only the single file with the latest timestamp. After running the task, you will be left only with the file artifact-1.3-20210227.102015-3.jar.

Delete Unused SNAPSHOT Task


We have replaced this task with the Cleanup Policies feature. We've preserved information about this task below for those still using it; however, as a best practice, you should now use the cleanup feature instead of this task.

The Delete Unused SNAPSHOT task deletes unusd SNAPSHOT components and assets from Maven repositories based on the number of days it has been since the artifact was last requested.

When you run this task, it will delete any SNAPSHOT version that has not been requested in your configured number of days.

The underlying soft-deleted blobs are permanently deleted using the strategy supported by the blobstore implementation.


In the event the component has never been requested this task will use the uploaded date instead.