As you might or might not know I have been using Apache Maven for quite a few years now and I have come to do all my development projects the maven way although I am probably not a full Maven maven. I am setting up a new development machine at home after being forced to look for a new job so I might as well write down what I do, since it is probably a bit different from the normal install.
For starters I am using Ubuntu Linux and I could just install Maven from the repository like this
sudo aptitude install maven2
and be done with it. I actually do that as a first step. However this does not play nice with having the latest and greatest version of Maven and getting the benefit of the numerous new features and bug fixes from new releases. I could use the Debian Testing repository and use apt pinning to stick with the version there, but things get hairy quickly that way. I also found I don’t have enough patience to wait for the package when a new release comes out, so I get the latest release from the
Apache site and stick it into /opt/apache-maven-2.2.0, add a symlink /opt/maven sudo ln -s /home/java/software/apache-maven-2.2.0/ maven and add M2_HOME and a M2_HOME/bin to the PATH in my ~/.bashrc.
With this install I get the latest Maven release together with the command completion from the Debian package. So I can type mvn and then use tab and get a list of options and lifecycle goals as well as use tab for command completion(see /etc/bash_completion.d/maven2 for details). Pretty sweet. As a lazy programmer I go one step further and add a bunch of aliases to my ~/.bashrc for often used commands.
alias mci='mvn clean install'
alias mcc='mvn clean compile'
alias mct='mvn clean test'
alias mi='mvn install'
alias mc='mvn compile'
alias mct='mvn test'
alias mcis='mvn clean install -Dmaven.test.skip=true'
alias mis='mvn install -Dmaven.test.skip=true'
alias mej='mvn exec:java'
Depending on projects I work with I also add specific aliases using profiles that need to used and more to additional aliases.
As the last but not least important job I install Sonatype Nexus as my local repository server. The instructions for the install in the Nexus book are all you need. I install Nexus on my developer machine for the following reasons:
So there you have it. Thats all the steps I go through to install Maven and then I bathe in luxury ;-)
Kelly Robinson
August 10th, 2009 at 23:05
Thanks for the post Manfred – of course, thanks to you I already have most of this in place, but there’s some great stuff here to increase dev productivity in general.
How to mavenize a typical web application build: JasperServer 3.7 sample webapp | simpligility
January 26th, 2010 at 06:39
[...] that we did the trivial first steps lets get this Maven thing going. After doing the install of Maven itself you just need the pom.xml file that you can edit in whatever IDE or editor you like. First we [...]
Improving the mavenized JasperServer 3.7 sample webapp build | simpligility
February 4th, 2010 at 00:37
[...] best thing to do is to start running a repository server like Sonatype Nexus yourself (something I recommend even for local development). You can just install the artifact into a repository on the server and everybody with access to [...]
Sonatype Maven Training – MVN 201 continued | simpligility
June 29th, 2010 at 22:38
[...] can only reiterate my point from what feels like ages ago – having a local Nexus install is [...]