Rebuilding hosted repos from local .m2/repository in nexus3

Hi community:

I’m faced with a dilemma. It’s a maven dilemma. I’ll spare you the saga and suffice it to say that the storage array that holds the data for our nexus2 install was damaged and so were the local and remote backups.

I figured we would turn this setback into an opportunity to prune the artifact tree and transition fully to nexus3. I’m sure I have most of our hosted artifacts living in my local .m2/repository folder. In nexus2, the files on disk were basically a plain-old-m2-repo. In nexus3, there’s this blob store.

Is there a tool or technique to push up all the artifacts I have locally into nexus3 hosted repositories? I know I could probably do it one by one using curl or the mvn deploy-file goal, but that seems like the hardest way to make this happen.

Could I stand up a nexus2, copy over all my artifacts, reindex, and then upgrade?

What is the best way to make this work?


Using the script is actually a pretty easy approach. The one here will work:

After doing this go to system/tasks in the admin UI and run a repair made a meta-data scheduled task.


Pretty slick.

I’ll give it a go once I’ve finished splitting up my artifacts into folders based on repos.

Thanks very very much!

1 Like