Home > Applications & Tools > How to Change Maven Offline Mode

How to Change Maven Offline Mode

Maven is a great tool when it works; otherwise it’s pretty hard to figure out what’s happening and how to fix problems. Instead of detailing steps to get something done, the Maven philosophy is to let developers to pick what they want. For the common use cases that fit in its convention, Maven is pretty easy. In general, Maven is easy to start, and hard to customize.

Anyway, I got into one problem a few days ago. Somehow I figured out the problem and fixed it later, but still have no idea why it was changed that way.

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure


A while back, I switched to NetBeans IDE due to its nice and integrated support for Maven. The experience has been really good. Normally I use Maven inside IDE, but for one project I had to use it with command line. So, I had to install the Maven as standalone and put the bin directory into the PATH environment variable. All worked well.

The project pom.xml file has a new plugin, which had never used on my machine before. So it had to be downloaded first. Somehow, it always stopped and failed the build. Initially I thought there was issue with the URL to the central repository, so I added explicitly repository section in the pom.xml. The problem persisted.

Plugin *** or one of its dependencies could not be resolved: Cannot access central (http://repo.maven.apache.org/maven2) in offline mode and the ***:jar:1.1 has not been downloaded from it before.

Reading carefully the output of the build failure showed that it’s offline mode somehow. After a bit research, the problem nailed down to the $HOME/.m2/settins.xml file. Somehow there is offline was set to be true. Therefore the maven command uses local repository only, which did not have the plugin yet.

                <netbeans.installation>C:\Program Files\NetBeans 8.0</netbeans.installation>

The fix was pretty easy – just change the value of the offline tag to be false. It started to work nicely.

It made me to think why the offline was there. Normally it should not be the case. I don’t remember I had changed the file manually. It’s also possible that NetBeans IDE changed it. Anyway, it worked and I had no incentive to dig down but take a note about the problem in case it comes again.

Categories: Applications & Tools Tags: ,
  1. Raichand Ray
    September 8th, 2015 at 02:11 | #1

    Dear Sir,
    I also use Netbeans.It is a great tool.I wanted to create a CRUD application using netbeans using spring(not spring MVC),Primefaces,Hinernate,and mysql.I had added spring jars to libraries but it did not got built.I had followed an eclipse tutorial.No netbeans tutorial available please help me.
    Raichand Ray

  2. September 8th, 2015 at 10:33 | #2

    Hi Richard, sorry to hear that. I don’t use Spring by myself, but if you use Maven you don’t add jars but add dependency in pom.xml. You may want to check Spring forum for more helps, or switch to the Eclipse based Spring IDE. Good luck!

  3. TranceVibes
    February 21st, 2017 at 20:27 | #3

    I had a similar issue. In eclipse I went to the preferences under the Maven section and unchecked “Offline”.

  4. February 22nd, 2017 at 02:53 | #4

    Thanks Trance, Haven’t touched Eclipse for a while as it lags behind other tools now.

  1. No trackbacks yet.