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?
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.