Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven local repository

Tags:

maven

I want Maven to work offline. I downloaded all artifacts like spring and hibernate onto my computer. Then I tried to set up Maven to use local repository only. I followed instructions to point Maven to local repository. However every time I tried to load spring mvc project, I got the errors like this:

Offline / Missing artifact org.springframework:spring-context:jar:3.0.6.RELEASE:compile Offline / Missing artifact org.springframework:spring-core:jar:3.0.6.RELEASE:compile

I checked the local repository. The jar and pom files are there. I can't figure out what is wrong with my configuration. Can someone help me out here?

Thanks.

Jerry

like image 692
CodeMonkey Avatar asked Nov 26 '25 13:11

CodeMonkey


2 Answers

You probably messed up your settings.xml.

Correct way to prepare for offline is this:

mvn install dependency:go-offline

The answer bilash.saha gave will not work for multi module projects.

After first command finished, you may test that everything is ok by running

mvn -o package

To save you a from typing "-o" every time use this settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
 <settings>
  <offline>true</offline>
 </settings>
like image 126
Dmitry Sidorenko Avatar answered Nov 29 '25 17:11

Dmitry Sidorenko


Run

mvn dependency:go-offline

then build your project offline using the '-o' flag:

mvn install -o
like image 40
bilash.saha Avatar answered Nov 29 '25 16:11

bilash.saha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!