Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stop maven from checking for updates

Tags:

eclipse

maven

How can I stop maven from checking for updates each time I start debugging a project from Eclipse? I hope this makes sense as I'm not too familiar with the java development environment.

It's just that everytime I start debugging, it will go checking for snapshot updates for dependent libraries. And this gets annoying on a slow internet connection.

like image 660
sean Avatar asked Jun 15 '09 07:06

sean


People also ask

Why does Maven download dependencies every time?

When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository. It helps to avoid references to dependencies stored on remote machine every time a project is build. Maven local repository by default get created by Maven in %USER_HOME% directory.

Why does Maven download so much?

This concept is known as "transitive dependency". Now, in order to "fill" the local repo maven has to download the jars to your local hard drive, that's why you see that it downloads a lot of stuff. So, answering your question, yes its normal maven behavior.

How often does Maven check for snapshot updates?

data-service project is releasing 1.0-SNAPSHOT for every minor change. Although, in case of SNAPSHOT, Maven automatically fetches the latest SNAPSHOT on daily basis, you can force maven to download latest snapshot build using -U switch to any maven command.

What is force update in Maven?

mvn clean install -U. -U means force update of snapshot dependencies. Release dependencies will be updated this way if they have never been previously successfully downloaded.


1 Answers

Use the -o flag if you're using the command line. From mvn -h:

-o,--offline Work offline


If you're using some sort of Maven integration like m2eclipse, the launch configurations usually have a 'Offline' check box.


Alternative: don't use SNAPSHOTs

Some might say that you're better of declaring release versions for all your plugins and dependencies, since that makes your build repeatable, i.e. instead of using

<version>1.0-SNAPSHOT</version>

use

<version>1.1</version>
like image 62
Robert Munteanu Avatar answered Sep 22 '22 22:09

Robert Munteanu