Python command line script to mirror packages of a remote Maven repository to your local repository
(~/.m2/) or to another remote target.
How it works:
- This tool executes
mvncommands usingmaven-dependency-plugin:getandmaven-deploy-plugin:deploy-filein standalone mode - without using a project'spom.xml. - Fine-grained configuration options: See examples in
example_config.yml. - Run multiple mirror scenarios sequentially.
- Useful in migration, backup or development scenarios.
- So far tested with GitLab Maven Repository and AWS CodeArtifact with Python 3.11+.
Quality: Alpha
Get this repository.
mvn- Install
pyyaml:python -m pip install --user pyyaml
Copy example_config.yml file and define your own package mirror settings.
- You can setup authentication to the source repository to fetch
maven-matadata.xmlvia acustomHeadersconfiguration property, e.g. by defining anAuthorizationheader. See examples inexample_config.yml. - You can use
${env_var}-syntax incustomHeadersto use environment variables - You can provide authentication for source and target repository using
settings.xmlfiles of Maven.
Evaluate that connections to remote repositories are working.
python mirror.py -c your_config_file.ymlLicense: GPL v3
Contributions are welcome!