0

I have a laptop which I can connect to the internet, and has downloaded all my maven dependencies into my .m2/repository. We have some PCs and some servers which cannot connect to the internet, and the PCs will need to compile and run Java code. So I'm thinking, I can install Nexus on one of the servers (even though it has no internet) and point all the PCs at that. Problem solved.

However, I have about 8000 dependencies in my local repository and don't particularly want to upload them one by one either via the GUI or using 'mvn deploy'. Is there a way to wholesale upload my entire local repository onto a Nexus server?

The closest answer I have found is here:

Running Maven and Sonatype Nexus while offline with no internet connection

"It's possible to upload the contents of your local repository to the Nexus server's storage area."

Specifically, how would I do that? I have had problems in the past where either the SHA1 file or some other metadata prevented it from working properly after I tried it. Any suggestions much appreciated!

Community
  • 1
  • 1
Matt
  • 3,303
  • 5
  • 31
  • 53
  • You can simple copy the content of your local repository to the server into the correct location and it should work (after indexing etc.) but i would suggest to connect the nexus server via Proxy to internet to make upgrading etc. easier. – khmarbaise Aug 24 '15 at 14:45
  • Thanks. It is impossible to connect the server to the internet with a proxy - believe me I've tried! The Networks team simply won't allow it. When you say 'after indexing', is that something I trigger manually once I've copied the local repository onto the server? And do I delete all '_maven.repositories', '*.sha1' and 'm2e-lastUpdated.properties' files or keep them in? – Matt Aug 24 '15 at 17:04
  • Have you considered running nexus on your laptop? configure your Maven build to pull it's dependencies from this Nexus and voila Nexus file system that could be replicated to another server within your network. (Ideally you should rack down the proxy problems or ask the network guys to create a firewall rule for your repo) – Mark O'Connor Aug 24 '15 at 20:12
  • @MarkO'Connor thanks, so you reckon copying a maven repository onto a Nexus server might be a bit dodgy, but copying the file structure from one Nexus server to another should be ok? Does Nexus do anything funky with the metadata like include server name that would make it difficult to replicate from one server to another? – Matt Aug 25 '15 at 10:21
  • Just cleaner to do a file rsync operation, rather than have to run background jobs to build indexes and metadata files. It also future proofs you against the day you finally "fix" the networking restriction, which I strongly recommend you do. FUD around the consumption of external dependencies needs to be addressed directly. – Mark O'Connor Aug 25 '15 at 22:15

0 Answers0