Install Maven1 under Linux. Prerequisites:
1) Download and install the JDK. Enter the command "Java-version" in the terminal, if a similar message appears stating that the JDK installation was successful.
$ java-version
Java Version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-bit Server VM (build 24.45-b08, Mixed mode)
2) Download eclipse. It is recommended to download the latest Java development version (my is Luna). This automates the integration of MAVEN plugins.
2. Start configuring MAVEN:
1) Download maven 3.2.3:http://maven.apache.org/download.cgi
2) Decompression apache-maven-3.2.3-bin.tar.gz, assuming that the decompression path is:/sandbox/my_maven/apache-maven-3.2.3.
3) Set Environment variables:
[Plain]View Plaincopy
- Set Maven_home System Variables
- $ export M2_home= "/sandbox/my_maven/apache-maven-3.2.3"
- Adding Maven_home\bin to an environment variable
- $ export path= $PATH: $M 2_home/bin
- Verify that you save
- $ echo $M 2_home
- Verify that the environment variable is set successfully
- $ mvn-v
- If a series of information appears stating that the environment variable is set successfully
Note: Since we are using export, the configured environment variables only work under the current shell, so do not close the current terminal in the middle, or you need to reconfigure.
If you want to configure a permanent environment variable, you can modify the /etc/profile or the. Bash_profile in the user directory. The previous one worked for all users, and the latter only worked for the user himself.
3. Create a MAVEN repository:
1) Create a folder, assuming the path is:/sandbox/my_maven/maven_repository.
2) Open the/sandbox/my_maven/apache-maven-3.2.3/conf/setting.xml file and set up our warehouse path:
[Java]View Plaincopy
- <!--localrepository
- | The path to the local repository maven would use to store artifacts.
- |
- | Default: ${user.home}/.m2/repository
- <localRepository>/path/to/local/repo</localRepository>
- -
- <localRepository>/sandbox/my_maven/maven_repository</localRepository>
3) Run commands in terminal to download files from the MAVEN central repository to Local:
$ mvn Help:system
4) without errors, open/sandbox/my_maven/maven_repository will find a lot more files.
Install Maven1 under Windows. Prerequisites:
1) Download eclipse. It is recommended to download the latest version of the Java development version (my is Luna). This automates the integration of MAVEN plugins.
2) Download and install the JDK.
3) Create a new system variable Java_home for the JDK installation path.
4) Add "%java_home%\bin" to "Path", which is the environment variable.
5) in the cmd input command "java-version", if a similar message appears stating that the JDK installation was successful.
2. Start configuring MAVEN:
1) Download maven 3.2.3:http://maven.apache.org/download.cgi
2) Unzip the apache-maven-3.2.3-bin.tar.gz, assuming the decompression path is: E:\eclipse\personal_file\apache-maven-3.2.3
3) Refer to the above method to set the system variable Maven_home to "E:\eclipse\personal_file\apache-maven-3.2.3" and add%maven _home%\bin to the environment variable.
4) Open cmd, enter "Mvn-v", the following words appear to indicate the success of the configuration.
3. Create a MAVEN repository:
1) Open the/sandbox/my_maven/apache-maven-3.2.3/conf/setting.xml file, you can see that the original Localrepository is commented out, resulting in the default Maven library for the home directory:
[Java]View Plaincopy
- <!--localrepository
- | The path to the local repository maven would use to store artifacts.
- |
- | Default: ${user.home}/.m2/repository
- <localRepository>/path/to/local/repo</localRepository>
- -
I personally do not like people to put the file, so will definitely set up a place where it should be to give it, if you need to change this directory in the Setting.xml file add a word on the good:
<localRepository>E:\eclipse\personal_file\.m2\repository</localRepository>
The middle part is the new MAVEN library address. The premise, of course, is that this address exists.
3) Open Eclipse,window->preferences->maven->user Settings, in the input box "User Settings" Select the settings.xml file changed above. Then click "Update Settings", you can see the following "Local Repository" Automatically update the path to Settings settings. By clicking the Apply button below, eclipse will automatically update the MAVEN library.
4) Since then, the MAVEN warehouse has been built. Open the warehouse path (here is E:\eclipse\personal_file\.m2\repository), you can find a lot more things.
4. Change the MAVEN installation configuration for Eclipse.
Open Window---preferences->maven->installations->add, add our own Maven address (for example, my is E:\eclipse\personal_file\ apache-maven-3.2.3) to "Installation home:". Select the installation after finish.
MAVEN build Environment (linux& Windows)