Java program to prune old snapshots from a maven repository.

Steinar Bang cbebbb9150 Use junit jupiter 5.11.0, mockito 5.13.0, assertj 3.26.3 пре 1 месец
.github d1cd8f9ccc Replace java 11 with java 17 in github actions CI build пре 6 месеци
src 6668204cd7 Use assertJ to assert the size of collections пре 6 месеци
.editorconfig 0e5b836016 Initial commit. пре 7 година
.gitignore 0e5b836016 Initial commit. пре 7 година
LICENSE 0e5b836016 Initial commit. пре 7 година
README.org ff66ca5f62 Change instructions in the README from running the snapshot pruner as fatjar to running "mvn exec:java" пре 2 година
pom.xml cbebbb9150 Use junit jupiter 5.11.0, mockito 5.13.0, assertj 3.26.3 пре 1 месец

README.org

Maven repository snapshot pruner

This is a Java application that will traverse a maven repository directory hierarchy and delete all deployed snapshot artifacts except for the snapshot version currently in the maven-metadata.xml files.

The program is intended to clean up snapshot repositories created with "mvn deploy" either using "file:" or "ftp:" URLs, and is intended to be run as a cronjob.

Status

file:https://github.com/steinarb/maven-repository-snapshot-pruner/actions/workflows/maven-repository-snapshot-pruner-maven-ci-build.yml/badge.svg file:https://coveralls.io/repos/github/steinarb/maven-repository-snapshot-pruner/badge.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=alert_status#.svg

file:https://sonarcloud.io/images/project_badges/sonarcloud-white.svg

Installation on a debian system

file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=sqale_index#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=coverage#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=ncloc#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=code_smells#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=sqale_rating#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=security_rating#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=bugs#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=vulnerabilities#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=duplicated_lines_density#.svg file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_maven-repository-snapshot-pruner&metric=reliability_rating#.svg

License

  1. Install the prerequisites
  2. #+BEGIN_EXAMPLE apt-get install git maven default-jdk #+END_EXAMPLE
  3. Clone and build the repository snapshot pruner
  4. #+BEGIN_EXAMPLE cd /var/www-maven/ mkdir -p .m2 chown -R maven.maven .m2 git clone https://github.com/steinarb/maven-repository-snapshot-pruner chown -R maven.maven maven-repository-snapshot-pruner cd maven-repository-snapshot-pruner sudo -u maven git config pull.ff only #+END_EXAMPLE
  5. Run the pruner once a day as that user (in the example the user with the username "maven" is used:
  6. Run this command as root
  7. #+BEGIN_EXAMPLE sudo -u maven crontab -e #+END_EXAMPLE
  8. In the editor that is opened add the following line (the ">/dev/null" is to avoid nightly emails, remove it if more debugging is needed):
  9. #+BEGIN_EXAMPLE 55 23 * * * cd /var/www-maven/maven-repository-snapshot-pruner; git pull >/dev/null; mvn compile exec:java -Duser.dir=/var/www-maven/repository >/dev/null #+END_EXAMPLE

The license is Apache Public License v 2.0.

See the LICENSE file for details.