Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting artifacts older than 2 years from local nexus repository

Tags:

nexus

We're running nexus on some old hardware which is limited in disk space and would like to remove artifacts older than a certain threshold.

Is there any way to do this other than a combination of find and curl?

like image 782
Jon Freedman Avatar asked Jul 17 '12 08:07

Jon Freedman


People also ask

How do I delete old artifacts from Nexus?

You have two options to get rid of artifacts which are not needed any more. First you can configure “cleanup policies”. Another approach is that you might want to set up a task which executes a custom Groovy script which deals with the removal of old artifacts.

How do I clean my Nexus repository?

Login to nexus as an admin user. Go to Server Administration and Configuration. Go to Repository >> Cleanup Policies.

Is Nexus Artifact repository?

Nexus Repository OSS is an open source repository that supports many artifact formats, including Docker, Java™, and npm. With the Nexus tool integration, pipelines in your toolchain can publish and retrieve versioned apps and their dependencies by using central repositories that are accessible from other environments.

How do I upload multiple artifacts to Nexus?

You can do it in a variety of ways: Use the Nexus artifact upload page (note this only works for multiple artifacts with the same groupId and artifactId). Set up a script, with multiple invocations of the maven-deploy-plugin's deploy-file goal, one for each artifact.


1 Answers

As mentioned on a Sonatype blog post linked from a comment in the blog in gavenkoa's answer, since Nexus 2.5 there is a built in "Remove Releases From Repository" scheduled task which can be configured to delete old releases keeping a defined number.

This is sufficient to meet our needs.

like image 181
Jon Freedman Avatar answered Sep 27 '22 20:09

Jon Freedman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!