How to Schedule Nexus Space Cleanup and Fix Missing maven-metadata.xml
This guide walks through configuring Nexus tasks—Maven snapshot deletion, blob store compaction, and Maven metadata rebuilding—to automatically free storage space and prevent metadata loss caused by cleanup policies.
Nexus is a Maven repository manager that lets teams host Java JARs, npm packages, Docker images, and other artifacts locally, reducing bandwidth and build time compared to downloading from the public Maven Central repository.
When continuous integration pipelines upload many snapshot artifacts, the Nexus server can eventually run out of disk space, triggering alerts.
1. Configure Maven - Delete SNAPSHOT task
In the Server Administration > Configuration area, open System → Tasks and click Create Task . Choose the task type “Maven - Delete SNAPSHOT” .
Set the minimum number of snapshots to retain and the maximum age (in days). When both values are set, Nexus first checks the age; if a snapshot is older than the maximum age, it is eligible for deletion, but the task will always keep at least the minimum number of snapshots.
Example: minimum = 3, maximum = 7 days. If there are five snapshots older than seven days, the task deletes the excess and keeps three; if only two snapshots are older than seven days, both are kept.
After configuring the task, select its execution mode: manual, run‑once, or a recurring schedule (hourly, daily, weekly, monthly). The example shows the task scheduled to run every Saturday at 00:00.
2. Configure Admin - Compact blob store task
Deleting snapshots does not automatically free the underlying blob storage. To reclaim space, create a “Admin - Compact blob store” task.
Select the blob store to compact and set the desired schedule, then save the task.
3. Configure Repair - Rebuild Maven repository metadata task
After the cleanup steps, the delete‑snapshot policy may remove some maven-metadata.xml files, causing downstream Maven clients to fail when downloading artifacts.
To repair this, create a “Repair - Rebuild Maven repository metadata” task. This task can rebuild metadata for all repositories or for a specific groupId and artifactId.
Schedule the metadata rebuild to run after the blob‑store compaction, ensuring that any missing metadata files are regenerated.
Following these three tasks—snapshot deletion, blob store compaction, and metadata rebuilding—automatically frees Nexus storage space and resolves the issue of missing maven-metadata.xml files caused by cleanup policies.
Author: shemg<br/>Source: https://shemg.cn/post/VocJ7vdWx/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
