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
mvn
commands usingmaven-dependency-plugin:get
andmaven-deploy-plugin:deploy-file
in 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.xml
via acustomHeaders
configuration property, e.g. by defining anAuthorization
header. See examples inexample_config.yml
. - You can use
${env_var}
-syntax incustomHeaders
to use environment variables - You can provide authentication for source and target repository using
settings.xml
files of Maven.
Evaluate that connections to remote repositories are working.
python mirror.py -c your_config_file.yml
License: GPL v3
Contributions are welcome!