Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force maven to download poms for offline use

Tags:

maven-2

my problem with maven is that if the maven repository is not responding, one cannot build. It seems to fetch every "mvn package" time some poms, which won't change, because they are of the same version.

How can I say to maven that please don't look them up from server, and instead download them permanetly to offline repository?

Thanks!

like image 282
egaga Avatar asked Sep 13 '09 08:09

egaga


People also ask

How do I force Maven to redownload dependencies?

In Maven, you can use Apache Maven Dependency Plugin, goal dependency:purge-local-repository to remove the project dependencies from the local repository, and re-download it again.

Why Maven dependencies are not getting downloaded?

If you run Maven and it fails to download your required dependencies it's likely to be caused by your local firewall & HTTP proxy configurations. See the Maven documentation for details of how to configure the HTTP proxy.

How do I force Maven to update dependencies?

We can force update in maven by using –U options by using mvn clean install command. In that –U means force update the dependencies of the snapshot. The release dependencies are updated is suppose there are not updated previously.


1 Answers

You can run maven with the -o flag:

 -o,--offline                           Work offline

This will cause Maven to never look for dependencies in remote repositories. On the other hand, your build will fail if the dependencies are not found in the local repository.

like image 200
Robert Munteanu Avatar answered Sep 28 '22 01:09

Robert Munteanu