Ransford Okpoti's Blog

31 July, 2016

Forcing Maven To Use The Local .m2 Repository

Filed under: Java — ranskills @ 6:54 am

If each Maven run on a project results in always downloading dependency jars even though they have already been downloaded and stored in your local .m2 repository which is by default located at USER_HOME/.m2 e.g., on my Windows 10 machine, mine is C:\Users\ransk\.m2, then you only have to instruct Maven to operate in an offline mode.

One way to do is to locate the main Maven install directory, this is referred to as the MAVEN_HOME, which contains the settings.xml file in the conf directory, e.g. E:\tools\apache-maven-3.3.9\conf\settings.xml.

The offline settings is off by default and it only has to be turned on by ensuring you have the entry below in the settings.xml file.


With this in place, Apache Maven will check to see if required dependencies are available locally before contacting any remote repositories.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at WordPress.com.

%d bloggers like this: