On Sun, Aug 22, 2010 at 10:43, Tim Daly <d...@axiom-developer.org> wrote:
> The fact that Maven uses http bit me today.
> I was working offline in a coffee shop,
> Maven tried to download something dynamically
> and failed. End of my development work.
This smells a little like the problem we had when the amateurs at my
$JOB installed a company-wide proxy, which cheerfully responded to
attempts to GET inaccessible URLs, not with a 404, but with a
successful status code an an HTML page explaining that the resource
was not available. (Obviously this was configured by morons laboring
under the delusion that the only clients of the HTTP protocol are
humans sitting in front of IE6.) In any event, maven responded by
storing the bytes it was so given as a *.jar file in its repository
(though of course, it was no jar file.) Failed builds and much
hilarity ensued.

I've found two techniques useful in mitigating maven's hunger for an
omnipresent Internet connection.

(1) When I'm *really* not on the net, I tell maven that by calling it
in offline mode. This will only help if the dependencies required by
the  build are already cached in the local ~/.m2/repository.

mvn -o

(2) I run a maven repository manager. Think of it as a caching proxy
for maven dependencies. I use the open source edition of Sonatype's
Nexus because it's dead-easy to get running.

At $JOB we have such a Nexus instance. I also have one at home running
on my server (a greying 1 GHz titanium PowerBook). I keep
~/.m2/settings.xml under version control with git, so it's easy enough
to 'cd ~/.m2 ; git checkout home' when I get home.

At home and at work, settings.xml is configured to route *all* maven
downloads through the appropriate nexus instance. I also keep a branch
around for when I'm truly out in the world without access to either of
the repository managers: 'git checkout nonexus'.

Having something like nexus around is nice because I do find it
occasionally useful to blow away ~/.m2/repository. It's nice not to
have to download everything from maven central all over again.

Though I do not currently do so, there's no reason why you couldn't
run a nexus on localhost. Bringing two laptops to the Cafe would seem
a tad excessive, after all. ;-)

I've set up a few Nexus instances and been fighting with Maven for
nearly five years now. I'll gladly share what experience I to help you
get things set up.

// Ben

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to