# Migrate Maven packages from Sonatype Nexus to GitHub Packages This gist describes the process we've used to migrate our Maven package repository from Sonatype Nexus to GitHub Packages. The same process could be used for migrating any Maven package repo that is in the standard layout. We created a special repository on GitHub to hold all of our Maven packages. You might decide to migrate packages to different repositories, in which case invoke the script multiple times. The script uses `find` to look for all of the folders containing poms and upload them. You specify the folder to start from, so you upload part of your repository. A hidden `.migrated-github-packages` file is created in each folder that's processed so you can interrupt and repeat the process. 1. Create the `maven-releases` GitHub repository as a private (or public) repository. 2. Create a personal access token for your GitHub account with permissions: `repo` and `write:packages`. 3. Create or edit your `~/.m2/settings.xml` to include a `` and `` element as in the example file, substituting your username and personal access token. 4. Run the script `migrate-nexus-to-github-packages.sh /srv/nexus/storage/releases maven-releases github` It is possible to paralellise the script, as GitHub is pretty slow at accepting each package (~30s / package). I recommend parallelising by artifact, as Maven isn't thread safe in the way it writes to its files. I achieved that quite simply by spawning individual scripts, one for each artifact, and running them in the background. Beware that Maven actually uses a bit of memory and CPU, so doing too many artifacts in parallel might overload your system.