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.
Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.
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.
<settings> ... <profiles> <profile> <id>netbeans-ide</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <netbeans.installation>C:\Program Files\NetBeans 8.0</netbeans.installation> </properties> </profile> </profiles> <offline>true</offline> </settings>
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.