Part X: Maven Repositories
If you've been paying attention to Maven's output, you've probably noticed it doing a lot of downloading the first time you use a phase or goal. It may have noticed the URL http://repo1.maven.org/
showing up a lot too. And you may have also noticed that Maven doesn't download anything the next time you use that same phase or goal. What's going on here?
The installation of Maven is very small. The first time you use a phase or goal, Maven will download the artifact for the plugin that provides the goal in question. It stores that artifact locally (in ~/.m2/repository by default) for future retrieval. The default place Maven looks to download artifacts from is the Maven Central repository located at http://repo1.maven.org
. This is also where it will try to retrieve any dependencies from.
You can configure projects to look in additional Repositories including 3rd Parties or your own company repository. You can also set your company's repository up as a caching proxy to the Central Maven Repository so that if it ever becomes unavailable (due to their server issues or your own internet connectivity issues), your developers can continue to work as normal.
The various types of repositories mentioned above are shown in the diagram below.