Offline Maven 2
Ever tried to run maven 2 with no network and Snapshots, after midnight…. its hard because it likes to check for updates of snapshots. The following in ~/.m2/settings.xml might help.
<?xml version="1.0"?>
<settings>
<profiles>
<profile>
<repositories>
<repository>
<id>local-repository</id>
<url>file:////Users/ieb/.m2/repository</url>
</repository>
</repositories>
<id>local-offline</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>local-offline</activeProfile>
</activeProfiles>
</settings>
Comments
3 Responses to “Offline Maven 2”
Leave a Reply
When I’m developing offline I just use
mvn -o clean install … Is that a valid solution too?
Yes -o will prevent maven looking for artifacts in remote repositories, but a 00:00 local time, it still checks for SNAPSHOT artifacts even with -o.
The hack allows maven to use your local repository as a remote repository. When there is no IP connectivity, it discovers that this is the only repo to work…. and all the SNAPSHOTS are upto date.
I found to be able to build sakai offline I also had to say to use my local repository as a plugin repository as the sakai plugin currently is a SNAPSHOT verstion.
Example of my settings.xml
local-offline
local-plugin-repository
Local Offline Plugin Repository
file:///C:/Documents and Settings/Matthew/.m2/repository
true
local-repository
Local Offline Repository
file:///C:/Documents and Settings/Matthew/.m2/repository
Which I then activate with “mvn -Plocal-offline”