vendredi 4 octobre 2013

Maven installation on Windows

Note: The following steps are optional if you use the m2e plug-in and don't plan to call Maven from the command line.
See the m2e plug-in installation for details.
  1. Download the ZIP file apache-maven-3.0.5-bin.zip and extract the folder it contains (e.g. 'apache-maven-3.0.5') to whatever location you like.
    (More recent versions can be downloaded from http://maven.apache.org/download.cgi).
     
  2. In the 'Start' menu right click on 'Computer' and select 'Properties', then click on 'Advanced system settings'.
    In the 'Avanced' tab click on [Environment Variables...].
  3. Create an environment variable 'M2_HOME' which value is the absolute path to the folder you've extracted.
    If that path value contains blank spaces then use the 'MSDOS 8.3' format (e.g. replace 'Program Files' with 'PROGRA~1' or 'Program Files (x86)' with 'PROGRA~2').
    For example your 'M2_HOME' value may be 'C:\PROGRA~1\apache-maven-3.0.5' or 'C:\PROGRA~1\maven' if you rename that extracted folder to 'maven':
  4. Append to your 'Path' environment variable the following: %M2_HOME%\bin;
     
  5. Make Maven locate and use the right JDK (i.e. version 1.7) by setting the 'JAVA_HOME' environment variable:
    • Either by setting that variable in the 'System Properties' like earlier for the 'M2_HOME' variable:
      Make sure you have already defined the environment variable 'JAVA_HOME' that points to your JDK installation (and not the JRE installation).
      If the path value in 'JAVA_HOME' contains blank spaces then use the 'MSDOS 8.3' format (e.g. replace 'Program Files' with 'PROGRA~1' or 'Program Files (x86)' with 'PROGRA~2') then save that 'JAVA_HOME' environment variable with that modified path value.
      Note: You may also add its 'bin' folder to your 'Path' by appending the following: %JAVA_HOME%\bin;
       
    • Or by creating/editing the file '%HOMEPATH%\.mavenrc' by adding a content similar the following:
      SET JAVA_HOME=C:\PROGRA~1\Java\jdk1.7.0_15
  6. Verify that your installation is working by opening a new command prompt (i.e. 'cmd.exe') and running the command:
    C:\> mvn -v
    Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
    Maven home: C:\PROGRA~1\apache-maven-3.0.4
    Java version: 1.7.0_15, vendor: Oracle Corporation
    Java home: C:\PROGRA~1\Java\jdk1.7.0_15\jre
    Default locale: en_US, platform encoding: Cp1252
    OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Aucun commentaire :

Enregistrer un commentaire