Maven (1)-Installation and configuration

Source: Internet
Author: User

First, the machine must be installed a good JDK

Second, maven download

http://maven.apache.org/download.cgi, download and extract the Maven-bin to your own directory (E:\java\maven)

Third, MAVEN system configuration

MAVEN is similar to JDK and needs to be configured in system variables:

    1. Right-click "Computer", select "Properties", then click "Advanced System Settings", click "Environment variables" to set environment variables, the following system variables need to be configured:
    2. New system variable Maven_home variable value: E:\java\maven
    3. Edit System variable Path add variable value:;%maven_home%\bin

Then enter the mvn-version command in CMD and get the following interface to indicate that MAVEN installation was successful.

Four, maven warehouse parameter configuration

The rationale behind Maven is to pull a rack from a remote repository to a local repository, where the remote repository has all the racks in an organization (for example, the MVN site has all the Java popular Java racks in the world, but an organization such as a company can also build its own company-wide maven remote repository). The local warehouse is placed in all Java projects in this machine from the remote warehouse pulled to the rack package, the native All Java project sharing these racks, different projects if the same rack package, the package only need to store a copy in the local warehouse, there is no need for each project copy, easy to manage (such as rack upgrade).

The above mentioned remote warehouses and local warehouses.

    1. The MAVEN default remote repository is: MVNrepository. com
    2. The default local repository for MAVEN is: C:\Users\ Current user name \.m2\

The address of both warehouses can be modified, especially the first remote warehouse, the default server in foreign countries, sometimes download rack package is very slow, there are many good maven remote warehouse, such as Oschina maven warehouse is very good, and very fast.

The address of the MAVEN remote repository can be done by modifying MAVEN's configuration: E:\java\maven\conf\settings.xml. Edit the Mirror node in this file and fill in the Oschina warehouse information as follows:

<mirrors>    <!--mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that | This mirror serves have an ID, that matches, the     mirrorof element of this mirror. IDs is used     | For inheritance and direct lookup purposes, and must is unique across the set of mirrors.     |    <mirror>      <id>mirrorId</id>      <mirrorOf>repositoryId</mirrorOf>      < Name>human readable Name for this mirror.</name>      <url>http://my.repository.com/repo/path</url >    </mirror>     <mirror>      <id>nexus-osc</id>      < mirrorof>*</mirrorof>      <name>nexus osc</name>      <url>http://maven.oschina.net /content/groups/public/</url>    </mirror>  </mirrors>

Of course, the general company has its own private MAVEN server, where the general use of their own business address.

The address of the MAVEN local repository can be done by modifying the Conf/setting.xml localrepository node.

<localRepository>E:\java\m2</localRepository>

Maven (1)-Installation and configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.