配置Maven项目

1、安装Intelij IDEA 2018.2并破解。

2、安装Apache-Maven-3.6.1,打开终端,添加环境变量。

vim ~/.bash_profile

i

export MAVEN_HOME=/Users/cengshiyu/Documents/apache-maven-3.6.1

export PATH=$MAVEN_HOME/bin:$PATH

esc

:wq

source ~/.bash_profile

mvn -v        //测试是否成功

3、新建repository文件夹,修改apache-maven-3.6.1/conf/setting.xml中的仓库为这个新文件夹的位置,并添加镜像地址。

<localRepository>/Users/cengshiyu/Documents/repository</localRepository>

<mirrors>

    <mirror>

        <id>alimaven</id>

        <mirrorOf>central</mirrorOf>

        <name>aliyun maven</name>

        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>

    </mirror>

</mirrors>

4、在intelij的偏好设置中修改Maven的三个地址。

5、打开项目,在终端中输入mvn install

6、右键项目-》Maven-》Reimport

猜你喜欢

转载自blog.csdn.net/qq_33514421/article/details/106663389