Will the .m2
folder be created automatically by Maven, or do you need to create it manually?
What does the .m2/repository
, contain and from where does it come?
Note that you don't actually need the . m2 location unless you want to create a distinct user settings file, which is optional (see the Settings reference for more details).
The Local Repository 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 . m2.
m2 folder is the default folder used by maven to store its: settings. xml file which specifies properties, like the central repository to download your dependencies, the location of the so-called localRepository. by default, the localRepository in which maven stores all the dependencies your project might need to run.
First, it will be created by Maven when you execute a build, such as:
mvn clean install
Note, you could find this out just be executing mvn your self ;)
Second, the contents of .m2 are:
A settings.xml
file that contains global settings for all maven executions.
A folder called repository
that holds all of the local copies of various maven artifacts, either caches of artifacts pulled down from remote repositories, such as Maven Central, or artifacts built by your local maven builds. The artifacts are organized in there in folder structures that mirror the groupId's of the artifacts.
It will be created automatically. The repository folder (also called local repository) will download its content from repositories specified in your user's settings.xml
, the global settings.xml
and possibly in your poms.
Most artifacts will be downloaded from repo1.maven.org
.
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