Maven 2 Installation (Windows)

Maven Download and Setup

1.Download Maven from here, http://maven.apache.org/download.html.  Download version 2.0.11 or higher.

2.Unzip the contents and place it in a folder such as c:/usr/java so that the folder c:/usr/java/apache-maven-2.0.11 is created.

3.Open the System Properties control panel using System, Control Panel, System.

4.Select the Advanced tab and click on the Environment Variables… button

5.Select the Path system variable and click Edit…

6.Add the path to the Maven bin directory to the Path environment variable by appending C:\usr\java\apache-maven-2.0.11\bin

7.Next set up a JAVA_HOME System variable to point to your JDK installation e.g. C:\Program Files\Java\jdk1.6.0_22

8.Open a Command Prompt so that we can confirm the Maven installation has been successful.

9.From the Command Prompt execute

mvn –version

Which will result in something similar to the following being produced.

Apache Maven 2.0.11 (r909250; 2010-02-12 05:55:50+0000)

Java version: 1.6.0_22

Java home: C:\Program Files\Java\jdk1.6.0_22\jre

Default locale: en_US, platform encoding: Cp1252

OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"

10.Finally, to complete the testing of the Maven installation we will create a temporary project.  Create a temporary directory, such as c:\usr\java\test and cd to it.

11.Issue the following command

mvn archeype:create –DgroupId=test –DartifactId=test

After a minute or so you should see

Downloading: http://repo1.maven.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.pom

[INFO] ----------------------------------------------------------------------------

[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:RELEASE

[INFO] ----------------------------------------------------------------------------

[INFO] Parameter: groupId, Value: test

[INFO] Parameter: packageName, Value: test

[INFO] Parameter: package, Value: test

[INFO] Parameter: artifactId, Value: test

[INFO] Parameter: basedir, Value: c:\usr\java\test

[INFO] Parameter: version, Value: 1.0-SNAPSHOT

[INFO] ********************* End of debug info from resources from generated POM ***********************

[INFO] project created from Old (1.x) Archetype in dir: c:\usr\java\test\test

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESSFUL

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1 minute 4 seconds

[INFO] Finished at: Sat Nov 06 14:48:55 GMT 2010

[INFO] Final Memory: 17M/251M

[INFO] ------------------------------------------------------------------------

12.Check that you got the BUILD SUCCESSFUL message and that the test sub-directory was created.

13.Delete the test directory as you have successfully installed Maven.  Return to Building Bluprint.