CodeMonkey
CodeMonkey

Reputation: 129

Maven local repository

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

Upvotes: 3

Views: 8244

Answers (2)

Dmitry Sidorenko
Dmitry Sidorenko

Reputation: 284

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>

Upvotes: 5

bilash.saha
bilash.saha

Reputation: 7316

Run

mvn dependency:go-offline

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

mvn install -o

Upvotes: 1

Related Questions