Skip to main content

Maven SNAPSHOT Tasks

Delete SNAPSHOT Task

Use the Delete SNAPSHOT task to soft-delete components from a Maven repository based on their timestamps. The task removes timestamped versions within "-SNAPSHOT" version folders. This task reduces storage needs by soft-delete versions that are no longer accessed after deploying new ones.

When creating the task specify the following:

  • The repository on which to run the task.

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

  • Snapshot retention (days) - delete versions older than the configured number of days while keeping those included in the minimum snapshot count.

  • Remove if released (checkbox) - Removes snapshot versions with the same groupId, artifactId, and base version as a release version. This tasks is prioritized before the minimum snapshot count.

    For example, the following snapshot is removed when release org.foo:project:1.0.0 exists:

    org.foo:project:1.0.0-20240129.130020-1
  • Grace period after release (days) - the number of days before purging released SNAPSHOTs. Snapshots are not removed when their timestamps fall within the grace period. The minium count and retention are prioritized over this property.

Delete Unused SNAPSHOT Task

Note

This task is replaced with Cleanup Policies. Use the cleanup feature instead of this task.

The Delete Unused SNAPSHOT task deletes unused SNAPSHOT components and assets from Maven repositories based on the number of days since the artifact was last requested. The uploaded date is used when the component has never been requested.

This task deletes any SNAPSHOT version not requested in your configured number of days.