--- Getting maven build environment [the first day]

First, the installation:

1. https://maven.apache.org/download.cgi download the latest version of Maven program:

2, extract to tomcat, maven to unzip

3, environment configuration:

New environment variable MAVEN_HOME, value: C: \ apache-tomcat-7.0.82 \ maven

4. Edit environment variables Path, Append% MAVEN_HOME% \ bin \;

5. Check whether the installation was successful:

mvn -v

 

 

Second, configure maven local repository:

 1. C: New maven-repository folder \ under apache-tomcat-7.0.82 directory, which is used as a local maven repository.

2. Open the C: \ apache-tomcat-7.0.82 \ maven \ conf \ settings.xml file, find the following line of code:

<localRepository>/path/to/local/repo</localRepository>

He copied to external comments:

Modify the value of our new folder path:

<localRepository>C:\apache-tomcat-7.0.82\maven-repository</localRepository>

3. localRepository node is used to configure a local warehouse, local warehouse in fact, it played a buffer role, its default address is C: \ Users \ username .m2.

When we get the package from the jar maven in time, maven will first look in the local warehouse, if the local warehouse is returned; if not from the remote repository to obtain package and stored in a local library.

In addition, we run mvn install in a maven project, the project will be automatically packaged and installed to the local repository.

4. run the DOS command

mvn help: system 
If the previous configuration is successful, then the D: \ Program Files \ Apache \ maven-repository will be some files.

Third, the configuration of the Maven Eclipse environment
1. Eclipse Oxygen, open Window-> Preferences-> Maven-> Installations, on the right side click Add.
2. Set maven installation directory, and then Finish
3. Select maven just added, and Apply.
4. Open Window-> Preferences-> Maven-> User Settings , and configured as follows Apply:

Guess you like

Origin www.cnblogs.com/ciscolee/p/10943189.html