maven local, central, remote ropositories


What are differences, similarities, uses of maven local, central, remote ropositories. When, why, how, where we use them.

Please advise.

Any links resources ideas highly appreciated. Thanks in advance
Asked On:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
Your "local" repository is just like a cache of all the maven artifacts that have ever been retrieved from remote repositories. It is where maven artifacts are referenced from when building/running applications via maven tools. You have no choice to use/not use this as all maven tools will first check the local repository and then if not present retrieve an artifact from remote repositories.

"central" and "remote" repositories are essentially the same, they are just repositories that are located remote from yourself (and therefore remote/different from your local cache). These are the true source location for the various artifacts. The difference between "central" and just any other "remote" repository, is just that the central repository is the one that is "built-in" to the maven tools, ie. you don't need to explicitly configure this one and so you can still resolve a large number of artifacts with no extra config. Other "remote" repositories are required to store and distribute artifacts that people want to distribute but don't necessarily want in the offical "central" repository, ie. if you build a JAR library and you want to distribute to a few of your friends, you probably wouldn't want that in the main, offical central repository so you just setup your own remote repository.
gudii9Author Commented:
>>are just repositories that are located remote from yourself

How they are located and retrieved from remote location. Using internet. Without internet connection I cannot retrieve or upload from remote/central repository. Please advise
mccarlIT Business Systems Analyst / Software DeveloperCommented:
How they are located and retrieved from remote location. Using internet
Yes, in general you need access to the internet to retrieve, the FIRST time that they are retrieved. As I mentioned above, once they are retrieved form the internet the first time, they are cached into your local repository and from then on, only accessed from that local repository.

Without internet connection I cannot retrieve or upload from remote/central repository
You have a couple of options...

If a machine doesn't have "internet" connection but IS connected via some LAN, WLAN, etc. you can set up a "remote" repository somewhere else on that LAN, on a machine that DOES have internet and it can act as a proxy.

Alternatively, if you have some way of getting the required resources into the machines local repository, than Maven can work just fine from then onwards, without needing the internet connection. This can be done either by giving the machine a temporary internet connection, allowing it to download the required resources, and then removing the internet connection. Or by copying the local repository from another machine that aleady has the required resources cached. The local repository is just a file hierarchy, generally in a directory called something like ".m2" and so you can copy the entire contents (recursively, including subdirectories) to the other machine and it will then be able to access all the same resources locally.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.