Skip to content

steinarb/maven-repository-snapshot-pruner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

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

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

Installation on a debian system

  1. Install the prerequisites
    apt-get install git maven default-jdk
        
  2. Clone and build the repository snapshot pruner
    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
        
  3. Run the pruner once a day as that user (in the example the user with the username “maven” is used:
    1. Run this command as root
      sudo -u maven crontab -e
              
    2. 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):
      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
              

License

The license is Apache Public License v 2.0.

See the LICENSE file for details.

About

Java program to prune old snapshots from a maven repository.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages