Gentoo Archives: gentoo-java

From: Alistair Bush <alistair.bush@×××××.com>
To: Gentoo Java <gentoo-java@l.g.o>
Subject: [gentoo-java] Taking Maven completely Off-Line
Date: Thu, 23 Jul 2009 01:07:15
Message-Id: 93e475bc0907221807h4e4346a3rc9a3160ca4425ca2@mail.gmail.com
>> This is a blantant copy and paste, but I thought it might be
interesting, useful. The other thing people talk alot about is other build tools that are better than Ant, e.g. Gant, Raven <http://raven.rubyforge.org/> (ruby build scripts for Java) or some other one I heard of recently – ah-ha! found it – Gosling<https://gosling.dev.java.net/>(I’m sure I read a recent article about it somewhere, that pointed to a newer website?) that lets you write your build in Java and then just wraps Ant! Bizzaro. Another one is that people are concerned about their build tool changing itself over time, and so their build is not necessarily stable and reproducible. I for one love the idea of self upgrading software – hey, it’s one step closer to the end of the world<http://en.wikipedia.org/wiki/Skynet_%28fictional%29>right? Well I for one welcome our build tool overlords.<http://itre.cis.upenn.edu/%7Emyl/languagelog/archives/000399.html>But seriously, I think that the advantage of having the build tool upgrade itself and getting the latest bug fixes and feature updates, outweighs the disadvantage of the build breaking one day. So what? – You take an hour out, or half a day, or even a day, and fix it! Buut, if you work in a stiff, rigid environment, or work for NASA or the militar or something, then there’s a way around this as well. This is also the suggested best practice for dealing with plugins. (O.k., I remember reading this information somewhere, but it was harder to find again than i thought.) 1. Run mvn help:effective-pom -Doutput=effective.pom this produces a list of the plugin versions your project is currently using. 2. Open effective.pom and copy the build->pluginManagement section into your pom, optionally deleting the configuration and just keeping the goupid, artifactid and version. 3. Make sure your project packages, to test you got the pluginManagement right. 4. Rename your local repository to repository.back 5. Run mvn dependency:go-offline – this will download all plugins and their dependencies for your project, into a clean repository. 6. Move the repository into your project directory. 7. Add the project repository to your POM as described above. 8. Try running your mvn package with the –offline option and make sure everythings ok. 9. Rename your backup from repository.bak back to repository. 10. Commit. 11. Done! You should be able to now build the project off of a fresh checkout and an empty repository. 12. If you’ve gone this far, you may as well also commit the version of Maven your using into your source control as well, in a directory such as /tools/maven. *** When MDEP-177 <http://jira.codehaus.org/browse/MDEP-177> is addressed, this will be much easier to do. On another note, as far as running off-line is concerned, the other really neat-o thing you should definately do if there are more than two of you on location (or if you’re keen to share snapshots easily), is setup a local Maven repository cache/proxy/mirror using Nexus <http://nexus.sonatype.org/>. IMO, don’t bother trying Artefactory or the other one, Nexus is da’ bomb. Copied from http://stubbisms.wordpress.com/