Help Center/ CodeArts Artifact/ User Guide/ Self-Hosted Repos 2.0/ Managing a Repository/ Configuring Clearing Policies for a Maven Repository
Updated on 2025-08-05 GMT+08:00

Configuring Clearing Policies for a Maven Repository

The clearing policy allows you to clear artifacts in batches. This helps optimize storage, keep artifacts organized, and ensure they are transferred correctly during development, testing, deployment, and release.

Background

A Maven snapshot is a special version that reflects the current state of ongoing development and differs from regular versions. During each build, Maven checks for new snapshots in the remote repository. You can set limits on how many snapshots to retain, as well as automatically clear out expired snapshots.

Snapshot Clearing Policy

  1. Click a project card to access the project and choose Artifact > Self-hosted Repos from the navigation pane.
  2. Select a Maven repository (Snapshot) from the list on the left and click Settings in the upper right corner of the page.
  3. Click the Clearing Policies tab.

  4. Set the maximum number of Snapshot Count. The value ranges from 1 to 1,000.

    When the number of retained snapshots exceeds the set limit, the oldest snapshot is replaced by the latest version.

  5. Enable automatic cleanup (No by default). Click Yes and enter the number of days. Snapshots older than the specified number of days will be automatically cleaned up.

    The automatic cleanup time must be set between 1 and 100 days.

  6. Click Save to complete the configuration.