How-To: Install Maven

Version 17

    Step-by-step instructions for getting Maven up and running to support your development.

    Current Maven Version: 2.2.1

    Use other versions at your peril.

     

    Note: Mac OS X comes pre-installed with a copy of Maven; be sure to double-check your version from the commandline after following the steps below, or things will break.

    Step 1: Get the Maven Binary

    You can download that here. No other plugins are required.

    Step 2: Unpack the Binary on Your System

    Mac

    Explode the zip on your system to /usr/local

     

    Windows

    Extract the downloaded Maven zip file to the root of the C: drive, this will create a maven-2.2.1 folder.

    Step 3: Set Your Environment Path

    Mac

     

    Add a M2_HOME environment variable to your ~/.bash_profile and point it to your download, e.g.:

    export M2_HOME=/usr/local/apache-maven-2.2.1

     

    Add the $M2_HOME/bin directory to your path, before /usr/bin.

     

    Windows

    Adjust the System Path Variable, appending a semi-colon and the location of the maven\bin directory as shown in this example as C:\maven-2.2.1\bin

     

    MavenInstallImg_007.jpg

     

    Add a M2_HOME environment variable as well. If you want to get fancy, you can define that first and substitute %M2_HOME%\bin in the System Path variable.

    Step 4: Test Your Installation

    Mac

    mvn --version
    Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
    Java version: 1.6.0_17

     

    Windows

     

    Open a new command window (the changes to the Path variable will not take effect in command windows opened previously) just as you had done to verify the correct operation of the Java Development Kit in the previous step. At the command prompt type:

     

    mvn –version

     

    You should see the response as indicated:

     

    1.jpg

    Step 5: Configure your Repository Settings

    Create a file called settings.xml in your OS user home directory as follows:

     

    OS

    Location

    OSX

    ~/.m2

    Windows

    %APPDATA%\..\.m2 (running mvn clean will create this for you in your Documents and Settings folder, or read this article for Windows installation tips)

     

    See Maven: Settings.xml File for the proper settings.xml file - download available on that page.

     

    Customize the properties to suit your environment.   The key variable is the location of Apache Tomcat 6 on your system.  Version 6.0.24 has been validated to work.  Cargo assumes you have downloaded and installed (unzipped) it on your filesystem.  Just point the settings.xml to the correct file path:

     

    Relevant section:

     

    <properties>
         <!-- Defines Tomcat home directory for Cargo -->     
         <tomcat6.home><![CDATA[/usr/local/apache-tomcat-6.0.24\]\]\></tomcat6.home>
    
         <!-- Specifies whether Cargo should stay alive after running integration tests -->
         <cargo.wait>false</cargo.wait>
    
         <!-- Overrides the value for the <setup> tag in jive_startup.xml -->
         <jive.setup>true</jive.setup>
    
     </properties>
    

     

     

     

     

    Properties defined in the settings.xml file are global and will apply to all Maven projects. Properties that may vary from project to project, such as <jiveHome> should not be defined here.