Hospedagem Profissional

Hospedagem Profissional
Clique aqui e ganhe US$ 10,00 para testar durante 1 mês a melhor hospedagem: Digital Ocean!

terça-feira, 19 de fevereiro de 2019

Clean Nexus3 release-repository

If you need a way to clean your "maven-releases" repository in Nexus 3, this is a solution to run as a task script:


More information in my github: https://github.com/leandrosilvaferreira/cleannexus3releaserepository

About this solution:

Clean Nexus3 release-repository

Groovy script to clean a release repository in nexus 3

Setup

  • In Nexus 3, go to "Server administration and configuration" -> "Manage scheduled tasks" -> "Create task"
  • Select type "Execute script"
  • Give a Name to task, select "Script language" as "Groovy" and select a "Task frequency" of your choice.
  • Past the script "Cleanup.groovy" in "Script source"
  • Click in "Create Task"

Options

  • retentionDays - Number of days to retain an artifact
  • retentionCount - Number of artifacts to retain independently of retentionDays
  • repositoryName - Repository name

Run

To run, you can click in "Run" button in the top of page.

Logs

To see the logs of execution, in server side, you can:
tail -f /usr/local/sonatype-work/nexus3/log/nexus.log

Info

Tested in a Nexus Repository Manager version OSS 3.1.0-04

License

This script is based in the following :