Search code examples
nexussonatypenexus3

How do I delete all packages with a given version in Sonatype Nexus 3


I don't want to have to select each package one by one and delete the version, this is incredibly tedious (there could be a 100 packages, but even 20 is painful using the UI).

What is the easiest way to achieve this?

I wish I could just do this from the Advanced Search from Browse, but there's no way I can see to multi-select and Delete isn't an option until I go to the folder tree view.

A Task would be nice, but all the tasks I see don't have filtering


Solution

  • You can achieve this by using the Cleanup Policies Feature.

    Here's how:

    Create a cleanup policy:

    Goto Administration->Repository->Cleanup Policies and click:

    - Create Cleanup Policy
    

    In cleanup criteria deselect all and then select:

    - Asset Name Matcher
    

    In the textfield add a regex to suit your needs. For example to clear the repo completely:

    .*
    

    For example to clear the repo of maven package "cert-cvc" version 1.4.9:

    .*cert-cvc-1.4.9.*
    

    Attach the cleanup policy to your repository

    Edit your Repository and add the cleanup policy you just created.

    Goto Administration->System->Tasks

     - Select the Cleanup service
     - Click Run
    

    It will cleanup the repository immediately.

    Once complete don't forget to remove the cleanup policy if you don't want it to kick in again at the next scheduled run.