Maven Installation Steps

The steps for Maven installations are as follows

How to install Maven?

1. Download Maven 2.0.8 from http://maven.apache.org/download.html

2. Extract zip file to MAVEN_DIR. MAVEN_DIR is extracted directory of Maven.

3. Set environment variable MAVEN_HOME to MAVEN_DIR. For ex. I have extracted zip file to E:\Softwares\apache-maven-2.0.8, So MAVEN_HOME is pointing to E:\Softwares\apache-maven-2.0.8

4. Apeend MAVEN_HOME\bin to path environment variable. For ex. My MAVEN_HOME is E:\Softwares\apache-maven-2.0.8, so I have added E:\Softwares\apache-maven-2.0.8\bin to path environment variable

5. Open commnad prompt and execute following command

Command>> mvn -version

It should display Maven version, JDK version and OS details. If you get these things then it menas you have sucessefully configured Maven

6. Deployment settings

Create a file named settings.xml at USER_HOME\.m2\settings.xml. For example. I have created settings.xml at C:\Documents and Settings\sarang_chalikwar\.m2\settings.xml

...

/path/to/local/repo/

true/false

repo1

repouser

<!-- other optional elements:

my_login_password

/path/to/identity (default is ~/.ssh/id_dsa)

my_key_passphrase

-->

...

...

For more details about proxy settings and setting up Mirror repository please go through http://maven.apache.org/guides/mini/guide-configuring-maven.html

How to create new project using Maven ?

1. Standard directory structure for project with one module

my-app

|-- pom.xml

`-- src

|-- main

| |-- java

| | `-- com

| | `-- mycompany

| | `-- app

| | `-- App.java

| `-- resources

| `-- META-INF

| `-- application.properties

`-- test

`-- java

`-- com

`-- mycompany

`-- app

`-- AppTest.java





About this entry