1

Hypothetically, if I've got an user account which doesn't have Internet access (e.g. for security reason the dev is stuck on a desktop inside a bunker), can I simply copy a few sub-repository directly into the user's ~/.m2/repository/ dir?

For example can I simply take the latest, say:

~/.m2/repository/net/sf/trove4j

directory from one system and manually copy it into the ~/.m2/repository/ of the user which doesn't have Internet access?

Would that work? I did a quick diff between two find ~/.m2 (one before and one after adding trove4j using Maven on the machine that has Internet access) and it looks like it's all there's needed.

But is there any gotcha? Should I worry about something?

Cedric Martin
  • 5,945
  • 4
  • 34
  • 66
  • 1
    I don't know why that shouldn't work; Maven just looks for files. You could also verify by manually installing an artifact on the isolated machine and comparing. – Dave Newton Sep 27 '12 at 21:43
  • 2
    Consider setting up a Maven repository manager (Nexus?) within the "bunker", if more than one developer needs to build the same code. Would save lots of of time, especially as you add more libraries over time. Easy to migrate data, in Nexus. Copy the files into a hosted repository and just regenerate the indexes – Mark O'Connor Sep 28 '12 at 18:35
  • @MarkO'Connor: +1 to your comment... I'll add that on our "TODO list" but at first I needed a "quick and dirty" way to try this out. It also helps me to better understand what's going on under the "Maven hood" :) – Cedric Martin Sep 29 '12 at 13:40

1 Answers1

1

AFAIK, this should be safe. I know we've done it with developer machines in the past and we've seen no problems. Maven uses the file and folder names in your repo to represent artifact id, group id, etc rather than using some xml file somewhere to hold this information. (Granted XML files are used within the repo for other reasons.)

Take a look at this question maven artifact repository directory structure specs and specifically the repo layout doc for more information on how the repo layout works.

Community
  • 1
  • 1
Jon7
  • 7,165
  • 2
  • 33
  • 39