第一步:下载maven安装包,配置环境变量MAVEN_HOME;变量值为maven的解压目录。
(参考地址:https://www.yiibai.com/maven/maven_environment_setup.html)
第二步:在myclipse中配置maven
![](https://img.haomeiwen.com/i2735732/a2f2fb3a37c1b087.png)
(1)添加maven的默认配置,更改为本地的maven
![](https://img.haomeiwen.com/i2735732/a77beec670ac5e27.png)
(2)修改settings.xml路径
![](https://img.haomeiwen.com/i2735732/716a1901f9ade51a.png)
第四步:创建maven项目:new→other→maven project→两个next→选择maven-archetype-quickstart→设置基本数据
第五步:运行pom.xml文件,右键pom.xml→run as→maven build,控制台会出现如下报错,这是因为我们要为jre的-Dmaven.multiModuleProjectDirectory传一个参数,即maven的环境变量。
![](https://img.haomeiwen.com/i2735732/4095541ec6eab8f4.png)
解决方法:
![](https://img.haomeiwen.com/i2735732/c0f27830578d62f0.png)
![](https://img.haomeiwen.com/i2735732/d2b36b20f8c559cd.png)
再次运行run as→maven build
![](https://img.haomeiwen.com/i2735732/2521dd6b9b92c001.png)
myeclipse中配置maven成功。
网友评论