I am reading up Maven - The complete reference and came across this
Maven assumes that the parent POM is available from the local repository, or available in the parent directory (
../pom.xml
) of the current project. If neither location is valid this default behavior may be overridden via the relativePath element.
What exactly is meant by local and remote repository for a Maven installation and a project?
A repository in Maven holds build artifacts and dependencies of varying types. There are exactly two types of repositories: local and remote: the local repository is a directory on the computer where Maven runs. It caches remote downloads and contains temporary build artifacts that you have not yet released.
Local repositories reside on the computers of team members. In contrast, remote repositories are hosted on a server that is accessible for all team members - most likely on the internet or on a local network.
Maven's local repository is a directory on the local machine that stores all the project artifacts. When we execute a Maven build, Maven automatically downloads all the dependency jars into the local repository. Usually, this directory is named .
There are 3 types of maven repository: Local Repository. Central Repository. Remote Repository.
A local repository is a local directory structure that caches artifacts downloaded from remote repositories, or those that are manually installed (eg from the command line option).
A remote repository is a web service (defined by a URL) that contains versioned artifacts. This might be as simple as an Apache server, or a full-blown Maven repository, such as Artifactory, that allows uploading, permissions based on a user directory, etc.
http://maven.apache.org/guides/introduction/introduction-to-repositories.html
By default, Maven will source dependencies from, and install dependencies to, your local .m2
repository. This is a precedence rule, and your .m2
acts like a cache where Maven can source dependencies before downloading them remotely. You can bypass this behaviour like so: mvn -U ...
(see mvn --help
).
Your local .m2
can be found under C:\Users\{user}\.m2
on Windows, or /home/{user}/.m2
on Linux. If you do a mvn install
, your project will be locally installed under the said .m2
repository.
A remote repository is a Maven repository, just like your local .m2
repository, hosted for you to source dependencies from, e.g. Maven Central.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With