21

I wanted to know if we can have mass upload of artifacts to the repository in Nexus.

Rich Seller
  • 79,705
  • 22
  • 167
  • 173
user170114
  • 565
  • 5
  • 15
  • 24
  • See this answer for a Groovy script that achieves the same thing but using the standard deployment process: http://stackoverflow.com/questions/3240477/upload-download-entire-directory-to-nexus-through-maven – Aaron Digulla Aug 29 '11 at 08:37

2 Answers2

16

You can do it in a variety of ways:

  • Use the Nexus artifact upload page (note this only works for multiple artifacts with the same groupId and artifactId).
  • Set up a script, with multiple invocations of the maven-deploy-plugin's deploy-file goal, one for each artifact.
  • If you have access to the file system, you can copy the files directly into [sonatype-work]/storage/[repository-name]. If you do this, set up scheduled tasks to rebuild the metadata and reindex the repository.
Rich Seller
  • 79,705
  • 22
  • 167
  • 173
  • 1
    in the latest version of nexus rebuilding the metadata is just right click on the repository in nexus – Chetan Dec 29 '12 at 10:22
  • 1
    I would not consider the nexus upload page useful for mass upload of artifacts since the file dialog it pops-up only allows a single selection - so every artifact requires multiple button clicks which gets old very quickly. – Jay Mar 01 '13 at 16:46
  • 1
    Third option worked like a champ, needed to click refresh a few times for it to pick up the changes on disk though. Just copy everything under the .../.m2/repository directory in the .../sonatype_work/nexus/storage/thirdparty directory. – cyber-monk Jul 12 '13 at 15:23
  • @cyber-monk I have nexus-3.12.1-01. I am not able to find storage folder. – Hiren Jun 18 '18 at 12:41
  • 1
    This will not work for Nexus 3 and above. The local storage is not in the form of plain binary files anymore; everything is stored as 'blobs'. – shasan Feb 07 '19 at 20:04
3

Use the Nexus Repository Conversion Tool to create Release and Snapshot folders based on your local .m2 folder and then move the contents of those folders into [sonatype-work]/storage/[repository-name].

Taylor Leese
  • 46,410
  • 27
  • 106
  • 138
  • That link appears to be dead or to now require a login. This question has some information on how to use the tool, though: http://stackoverflow.com/questions/4243477/update-nexus-repository-with-local-artifacts – James Jul 07 '16 at 03:28