Search This Blog

Wednesday, 9 April 2014

How to install Maven

I found than our junior colleagues can't install environment on the test machine, maven, java etc. So, I decided write a few messages about installation procedure these tools...

Maven

Maven, a Yiddish word meaning accumulator of knowledge, was originally started as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects each with their own Ant build files that were all slightly different and JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information and a way to share JARs across several projects.

The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.


Maven's Objectives

Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:
  • Making the build process easy 
  • Providing a uniform build system 
  • Providing quality project information 
  • Providing guidelines for best practices development 
  • Allowing transparent migration to new features 


What is Maven Not?

You may have heard some of the following things about Maven:
  • Maven is a site and documentation tool 
  • Maven extends Ant to let you download dependencies 
  • Maven is a set of reusable Ant scriptlets 
While Maven does these things, as you can read above in the "What is Maven?" section, these are not the only features Maven has, and its objectives are quite different.

Maven does encourage best practices, but we realise that some projects may not fit with these ideals for historical reasons. While Maven is designed to be flexible, to an extent, in these situations and to the needs of different projects, it can not cater to every situation without making compromises to the integrity of its objectives.

If you decide to use Maven, and have an unusual build structure that you cannot reorganise, you may have to forgot some features or the use of Maven altogether.

Install Maven

1. Go to the official website of Maven in the download section and download the latest stable version (example - pache-maven-3.2.1-bin.tar.gz)

2. Please check JAVA_HOME
In command line after execution the command echo %JAVA_HOME% you will see the path to JDK

3. Unpack the archive into the work directory. For example for Windows - C:\maven

4. Set the environment variable M2_HOME with the link into the repository and M2 with a link to the folder %M2_HOME%\bin


5. Set the PATH environment variable in the Windows PATH variable, add a line to the list: %M2%


6. Check with the command mvn -version . If you see



Congratulation, Maven installed!

The documents here are also helpful to new Maven users.

No comments: