Eeclipse integrated maven to build spring MVC

Source: Internet
Author: User

First, download maven

1.:https://maven.apache.org/

2. Extract the downloaded Zip package to the specified directory, such as: E:\Tools\apache-maven-3.3.3

3. Configure the MAVEN environment variable, add the environment variable m2_home:e:\tools\apache-maven-3.3.3, and then add the value after the environment variable%m2_home%\bin

4.win+r, enter CMD to start the DOS command line, enter Mvn-version, as shown, that is, the installation is complete.

Second, Eclipse integration maven

1. If you downloaded the latest version of Eclipse, then he installed the Maven plugin by default, you only need to configure the MAVEN path installed, otherwise you need to search eclipse how to install the Maven plugin, the eclipse of this article has installed the MAVEN plugin by default.

2.

3.

Copy the installed MAVEN conf path under the Setting.xml file to the native user directory: C:\USERS\ADMINISTRATOR\.M2, the benefit is that you do not need to modify the Setting.xml file every time you upgrade the MAVEN version. and modify Setting.xml as follows:

<?xml version= "1.0" encoding= "UTF-8"?><!--Licensed to the Apache software Foundation (ASF) under Oneor more contr  Ibutor license agreements.  See the NOTICE filedistributed with this work for additional informationregarding copyright ownership. The ASF licenses this fileto you under the Apache License, Version 2.0 (the "License");  Except in Compliancewith the License. Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or Agreed to Writing,software distributed under the License are distributed on a "as is" BASIS, without warranties OR Condi  tions of Anykind, either express or implied. See the License for Thespecific language governing permissions and limitationsunder the license.--><!--| The configuration file for Maven.  It can specified at levels: | | 1. User level.                 This settings.xml file provides configuration for a single user, | and is NormaLly provided in ${user.home}/.m2/settings.xml.                 | |                 Note:this location can is overridden with the CLI option: | |  -s/path/to/user/settings.xml | | 2. Global level.                 This settings.xml file provides configuration for all Maven |                 Users on a machine (assuming they ' re all using the same Maven | installation).                 It ' s normally provided in | ${maven.home}/conf/settings.xml.                 | |                 Note:this location can is overridden with the CLI option: | | -gs/path/to/global/settings.xml | | The sections in this sample file is intended to give you a running start at | Getting the most out of your Maven installation. Where appropriate, the default | VALUES (values used when the setting isn't specified) are provided. | |--><settings xmlns= "http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi= "http://www.w3.org/2001/xmlschema- Instance "xsi:schemalocation=" Http://maven.apache.org/Settings/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd "> <!--localrepository |   The path to the local repository maven would use to store artifacts.   | | Default: ${user.home}/.m2/repository--<localrepository>e:\workspace\maven\repository</ localrepository> <!--Interactivemode | This would determine whether Maven prompts when it needs input. If set to False, | Maven would use a sensible default value, perhaps based on some other setting, for |   The parameter in question.   | | Default:true <interactiveMode>true</interactiveMode> <!--offline |   Determines whether MAVEN should attempt to connect to the network when executing a build. |   This is a effect on artifact downloads, artifact deployment, and others.   | | Default:false <offline>false</offline> <!--plugingroups | This was a list of additional group identifiers that would be searched when resolving plugins by theirprefix, i.e. | When invoking a command line like "Mvn prefix:goal". Maven would automatically add the group identifiers |   "Org.apache.maven.plugins" and "Org.codehaus.mojo" if these is not already contained in the list. |--> <pluginGroups> <!--plugingroup |    Specifies a further group identifier to use for plugin lookup. <pluginGroup>com.your.plugins</pluginGroup> </pluginGroups> <!--proxies |   This is a list of proxies which can being used on the the network. | Unless otherwise specified (by system property or command-line switch), the first proxy |   Specification in this list marked as active would be used. |--> <proxies> <!--proxy |     Specification for one proxy, to is used in connecting to the network.    | <proxy> <id>optional</id> <active>true</active> <protocol>http</prot Ocol> <username>proxyuser</username> <password>proxypass</password> 

The localrepository tag is a warehouse path that configures the dependency package for MAVEN downloads if the default path is not configured: C:\Users\Administrator\.m2\repository

The mirror tag is configured to download the mirrored environment when the dependent jar package is downloaded, because we sometimes have a slower access to Maven's central warehouse http://mvnrepository.com, so we have configured a UK mirroring environment here.

By completing these, our eclipse integrates Maven and can start building a spring MVC project.

Third, build the Spring MVC project:

Refer to: http://www.cnblogs.com/fangjins/archive/2012/05/06/2485459.html

Of course, it is also possible to execute DOS commands in the workspace directory: mvn archetype:generate-dgroupid=springmvc-dartifactid=test1-dartifacttypeartifactid= Maven-archetype-webapp builds a MAVEN project and then passes MAVEN import to eclipse.

GroupID and Artifactid are the two coordinates of MAVEN, General GroupID is the name of the big project, Artifactid is the name of the big project Small project.

Eeclipse integrated maven to build spring MVC

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.