版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Gpwner/article/details/81045581
Jetbrain的IDEA工具是集成了Maven的,但是经过试验我发现在学校使用校园网是不需要做任何操作就可以将maven的依赖项目下载下来。但是,非校园网就没有这么顺利了。此博客将记录搭建IDEA中的Maven环境。初始环境下的IDEA的Maven设置是Bundled(Maven3):
将候选项目下拉然后选择IDEA默认插件位置中的maven:
进入到相应位置打开settings.xml文件,
修改mirror为阿里云镜像:
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be 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>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
IDEA的默认Maven会将依赖项目下载到${user.home}/.m2/repository
目录下,这个位置是在C盘中,如果你的C盘足够的话就无所谓了,如果C盘不足的话,可以重新制定位置只需修改:
<localRepository>D:\maven3_repository</localRepository>
至此,IDEA默认的Maven环境搭建完成