I. Setting environment variables
1. Open terminal, enter CD ~
2. Enter Touch. Bash_profile (If the file does not exist, an empty file will be created)
3. Enter Open. Bash_profile (call Notepad to edit the file)
Ii. Settings for Maven 3.1.1
In the. bash_profile file, refer to the following statement:
Maven_home=/usr/share/java/maven-3.1.1export Maven_homeexport Path=${path}:${maven_home}/bin
Note:
A) Download the latest maven from MAVEN's website (3.1.1 in this article), unzip it to the/usr/share/java/maven-3.1.1 directory, and if you are not, adjust the path in the first row
b) in the Finder, navigate to/usr/share/, remove the MAVEN alias (alias-Windows-like shortcut) (after installing Xcode, the MAVEN 3.0.3 environment is configured by default), and then create a "/usr/share/ java/maven-3.1.1 "Alias (How to: Right-click on the maven-3.1.1 directory, create an alias), alias name is still changed to Maven, and finally copied to/usr/share/, the purpose is to replace maven this" shortcut " The path pointed to is the latest path
Detection method: Restart the terminal input echo $MAVEN _home, under normal circumstances, you can see the directory output MAVEN, and then enter Mvn-version, if you see the version is 3.1.1, indicating that the configuration takes effect.
Third, the configuration of jdk1.7.0.45
Download the latest JDK from Oracle website (currently 1.7.0.45) after installation, although the terminal command line Java-version, the version shown is already 1.7, but does not automatically set Java_home environment variables, step two, if the input mvn-version Detection, see the JDK may still be 1.6, or according to just the idea, open. Bash_profile, change to the following:
maven_home=/usr/share/java/maven-3.1.1java_home=/library/java/javavirtualmachines/jdk1.7.0_45.jdk/contents/ Homeexport Maven_homeexport Java_homeexport Path=${path}:${maven_home}/bin:${java_home}/bin
Environment variables, maven3.1.1 and jdk1.7.0.45 configuration under Mac