Maven - Setup - Windows
I am writing this as I am doing the same myself on my Windows machine. And if you are one of those developers who are still using windows for development, these windows specific uncluttered instructions and links will be of useful.
Step 1: Obtain Maven Binary: Maven 2.0.1
Fuji uses Maven based project system and its needed for you to make use of Fuji. As of this writing, 2.0.1 is latest Maven available at,Step 2: Extract Maven
Maven 2.0.1 .
If you want to use any other version of Maven, you can find here at All Maven Binaries.
The binary that you obtained from the above step is a windows zip file. Most probably, you can extract it by double clicking it. If not, see whether you have WinZip, which is not free, but you can try it for free. You can also try extracting with WinRAR.Step 3: Setting up of Windows Environment for Maven
I always have a handy folder like "Software" on my root directory, which is easy for me to figure out what all I installed. The "Program Files" folder is too much crowded and not every software can handle the "Spaces" in the directory names.
I myself, extracted the Maven onto C:\\Software, so that I can find maven at C:\\Software\\apache-maven-2.1.0-M1.
The maven should be made available to those applications that needed it. The Windows environment can be enhanced with variables to launch maven. However, its kind of global. Same maven version is available everywhere and it doesn't offer you to choose among the various versions of maven to use with different applications. Alternatively, you can create a batch file with all the necessary commands in it for that application. You must execute this batch file, very first time after launching the command prompt. So, as usual, you have choices and need to make a choice.
Choice 1: Update Windows Environment system wide
1.1. Launch System Properties for setting up M2_HOME
You can do it by either1.2. Set up Maven Home
Right clicking "My Computer" icon generally available on your Desktop
or
Windows Start -> My Computer -> View System Information
Properties -> Advanced -> Environment Variables -> System variables -> New
1.3. Update Windows PathVariable Name: M2_HOMENote: The variable value depends on where you extracted the maven. The above is as on my system.
Variable Value: C:\\Software\\apache-maven-2.1.0-M1
If you have closed System Properties window, repeat Mini Step 1 to launch it.
Properties -> Advanced -> Environment Variables -> System Variables
Select "Path" and then Click "Edit". Then Add ";%M2_HOME%\\bin" at the end and then click "OK".
Choice 2: Make a batch file
Create a batch file, say "env.bat". The name can be anything with extension of "bat". And then have the following commands in it.
set M2_HOME=C:\\Software\\apache-maven-2.1.0-M1And this is my choice. Simple and better control.
set PATH=%M2_HOME%\\bin;%PATH%
Step 4: Ensure Maven is Available
Open Command line prompt, Windows Start -> Run and then type, cmd. A command window opens up. If you haven't set the system wide properties, set your directory wherever env.bat is there and then type "env" at the command prompt.If its success, then you will see all that mvn is displaying....
If you get the following, then MVN isn't properly setup. Check your setting.
C:\\Documents and Settings\\rdara>mvn
'mvn' is not recognized as an internal or external command,
operable program or batch file.
No comments:
Post a Comment