I was trying this on one of my virtual machines setup by my colleague, its a GNU / Linux Kernel 32bit CentOS operating system.

Maven installation is quick and easy. In fact, i just came out of a technical interview previously that required me to demonstrate light programming with only a notepad, command prompt and access to the internet. I was really tempted to download putty and connect to one of my available remote Linux shells because frankly, command lines around the Windows Command Prompt shell isn’t that similar to say bash or sh in GNU / Linux kernel OSes.

It was no doubt a test of familiarity but they were looking for more.

  1. Did you package your codes in their correct logical groups?
  2. Did you specialize your classes according to their business behaviors?
  3. Did you code to interface?
  4. Do you know Java? =p

Not so much on the algorithm because all in all, its a one hour test.

Maven is more than a build tool that i can’t explain fully the wonders and concepts behind it from where i am writing this article (Starbucks sipping a cold coffee that is just outside of my office) without a handout or guide!

But i am here to show you and possibly guide you through the Maven installation process. To sum it up, this is what i have done actually.

  1. Download Maven
  2. Unzip Maven
  3. Set Maven path
  4. Test installation

Step 0: Go into your shell!

As mentioned i am using CentOS Linux Kernel OS, you should be using something similar, perhaps Ubuntu, Gentoo, RHEL, Fedora, or some Unix variants. (If you are using HP-UX or OS-Z please share with us your experience! =p)


Step 1: Download Maven

You should go the Google, search for Maven, then find your way to an available maven repository, it could be HTTP or FTP access. Choose the mirror that is closest to you (if you are running a VM from where you are testing this) or closest to your server (if you are remoting over SSH). Word of caution: Don’t try this on a production or important server please!

http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0-bin.tar.gz

$wget http://apache.oss.eznetsols.org//maven/binaries/apache-maven-3.0-bin.tar.gz

You would see the output of wget very similar to what i have, and doing a ls -l shows the file you just downloaded. Depending on revision, your size may be different from mine.


Step 2: Unzip Maven

Well, it is untar Maven if you must! Remembering the correct command for tar and untar is trivial if administration is all you play around every other day. I often browse the manual in place of this (knowledge :P).

$tar -xzf apache-maven-3.0-bin.tar.gz

Once untar is complete, you should be able to see the unzipped folder using ls or ls -l.


Step 3: Set Maven Path

Well its set bin to path, but i figured this is more catchy. To do that, you need to determine where you are doing to install maven. Ideally, a package manager would have this handled for you. If not this should really go into your opt directory.

I put this in my home directory /home/ken for testing only. You shouldn’t if for serious work.



$export PATH=/home/ken/apache-maven-3.0/bin:$PATH

Done!


Step 4: Test Installation (Optional, really.)

This is totally optional, it is in place to help you test your Maven installation.

$mvn –version

You should get an output similar to the below.


Warning: JAVA_HOME environment variable is not set.
Apache Maven 3.0 (r1004208; 2010-10-04 19:50:56+0800)
Java version: 1.6.0_17
Java home: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
Default locale: en_US, platform encoding: UTF-8
OS name: “linux” version: “2.6.18-194.17.1.el5″ arch: “i386″ Family: “unix”

Warning: JAVA_HOME environment variable is not set.Apache Maven 3.0 (r1004208; 2010-10-04 19:50:56+0800)Java version: 1.6.0_17Java home: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jreDefault locale: en_US, platform encoding: UTF-8OS name: “linux” version: “2.6.18-194.17.1.el5″ arch: “i386″ Family: “unix”

Cheers, Complete! Back to office.

Share